Container to easily set up Interactive Brokers Gateway in a headless environment.
This assumes some basic working knowledge of Docker. The getting started tutorial is the fastest way to learn the basics.
-
Check out the repo.
-
docker build -t <pick-a-name> .
from within the repo. You should build your own image rather than use one on dockerhub for security reasons. -
Set your own environment variables as necessary in
docker-compose.yml
. This likely includes copying ajts.ini
file in from a computer you have used IB on already. -
docker-compose up
-
The IB API is now available from your host on
127.0.0.1:4003
IBController.ini
and jts.ini
are mounted as volumes from the host into the docker container. You can configure them from the host, launch docker and the settings will be available in the container.
Port 4001 is hard-coded as the IB port from within the container. Port 4003 is hard-coded as the API port, accessible from host.
In order for docker to bind a port from the host into the container, the service must be running on 0.0.0.0: from within the container. socat
is used to bind 0.0.0.0:4003 onto the same process launched by IBController
.
In future these should be set by environment variables, but running into issues where we try to use the same port for both.
Some work has been done to set up VNC into the xvfb session, but I have not found it necessary and will likely remove it soon.