- IB Gateway: 
v10.12.2h - IBC: 
v3.12.0 - ib_insync: 
v0.9.70 
- Download the latest IB Gateway installation script from here to your cloned repo.
 - Set 
TWS_USER_IDandTWS_PASSWORDrespectively in your system's environment. - Run the following:
 
docker-compose up --build
You will now have the IB Gateway app running on port 4003 for Live trading and 4004 for Paper trading. See docker-compose.yml for configuring VNC password, accounts and trading mode.
WARNING: All IPs on your network are able to connect to your box and place trades - so please do not open your box to the internet.
This repo is built on mvberg's and dvasdekis's work.
- Replaced IB Controller with IBC
 - Ubuntu 16.04 → 20.04
 - Removed installers after use
 - Compatible with Stackdriver logging
 - Optimization of Java runtime options
 - VNC scripting (which didn't restart the container on error) fixed via Supervisor
 - Optimized for e2-small instance on GCP
 
- Example usage for dual paper/live containers
 - Minor refactors and abstractions
 - Version updates
 
To start an instance on Google Cloud:
gcloud compute instances create-with-container my-ib-gateway --container-image="docker.io/dvasdekis/ib-gateway-docker:v978" --container-env-file="./ibgateway.env" --machine-type=e2-small --container-env TWSUSERID="$tws_user_id",TWSPASSWORD="$tws_password",TRADING_MODE=paper --zone="my-preferred-zone"
- Uncomment the lines marked 'ports' in docker-compose
 - SSH into server and run 
mkdir ~/.vnc && echo "mylongpassword" > ~/.vnc/passwd && x11vnc -passwd mylongpassword -display ":99" -forever -rfbport 5900as root - Log in with a remote VNC client using 
mylongpasswordon port 5901 
IBC has decided to not support switching off the Read-Only checkbox (on by default) on the API Settings page.
To work around it for some operations, you'll need to write a file named ibg.xml to /root/Jts/*encrypted user id*/ibg.xml. The ibg.xml file can be found in this folder after a successful run and close, and contains the application's settings from the previous run.
Sometimes, when running in non-daemon mode, you'll see this:
Exception in thread "main" java.awt.AWTError: Can't connect to X11 window server using ':0' as the value of the DISPLAY variable.You will have to remove the container docker rm container_id and run docker-compose up again.