Repository navigation
Moving from IBC to ibcontroller: migration guide #468
gnzsnz
announced in
Announcements
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Summary
This image is moving its controller from IBC to ibcontroller, a Python controller with a small Java agent, inspired by IBC. Existing compose and env files stop working as they are: variables are renamed and move to a new
ib.envfile. This was announced on 2026-11-18. The switch onmasteris not before 2027-01-10. Nothing changes for current images before then.Timeline
masterkeeps publishing IBC images.latest,stable) gets its first ibcontroller image on its next IBKR release after the switch. From then on,latest,stableand the minor tags (10.52,10.50style) point to ibcontroller images.deprecated/IBC.Stay on the IBC image
Pin an exact version tag that was published before the switch. This works for both images:
ghcr.io/gnzsnz/ib-gateway:10.50.1h(stable channel)ghcr.io/gnzsnz/tws-rdesktop:10.50.1h(stable channel)ghcr.io/gnzsnz/ib-gateway:10.52.1dandghcr.io/gnzsnz/tws-rdesktop:10.52.1d(latest channel)A pinned image stays available but gets no updates after the switch. An old Gateway or TWS version is usable only while IBKR accepts it. That is typically some months, with no promise.
For a local build, check out a repository tag, for example
v10.50.1h-stableorv10.52.1d-latest, or the last tag of your channel before the switch.Migrate: steps
ib.env-disttoib.env. Move your settings there using the table in the next section. SetIBC_USERIDandIBC_PASSWORD..env-distto.env. Keep only container variables there and setTZ.docker-compose.yml,tws-docker-compose.yml).docker compose up.declarative settings applied (N)and forREADY. Then connect an API client on the forwarded port.Credentials, before and after:
Variable map
Every variable of the current
.env-dist,docker-compose.ymlandtws-docker-compose.yml. Both images are covered,ib-gatewayandtws-rdesktop. Target-specific items are marked.TWS_USERIDIBC_USERIDib.envTWS_PASSWORDIBC_PASSWORDib.envTWS_PASSWORD_FILEIBC_PASSWORD_FILEib.envIBC_USERID_FILEalso exists nowTWS_USERID_PAPERIBC_USERID_PAPERib.envIBC_TRADING_MODE=bothTWS_PASSWORD_PAPERIBC_PASSWORD_PAPERib.envbothTWS_PASSWORD_PAPER_FILEIBC_PASSWORD_PAPER_FILEib.envbothTRADING_MODEIBC_TRADING_MODEib.envlive,paperorboth;bothis still provided by the imageREAD_ONLY_APIIBKR_READ_ONLY_APIib.envyes/noandtrue/falseare both acceptedTWOFA_TIMEOUT_ACTIONIBC_MFA_TIMEOUT_ACTIONib.envexitorrestart;restartneedsIBC_RELOGIN_AFTER_MFA_TIMEOUT=yesTWOFA_EXIT_INTERVALIBC_MFA_EXIT_INTERVALib.envRELOGIN_AFTER_TWOFA_TIMEOUTIBC_RELOGIN_AFTER_MFA_TIMEOUTib.envTWOFA_DEVICEBYPASS_WARNINGIBKR_API_PRECAUTIONS_BYPASS_ORDER_PRECAUTIONSandIBKR_API_PRECAUTIONS_BYPASS_BOND_WARNINGib.envBypassOrderPrecautionsandBypassBondWarning; set both. ibcontroller offers six moreIBKR_API_PRECAUTIONS_BYPASS_*variables, seeib.env-distAUTO_RESTART_TIMEIBKR_AUTO_RESTART_TIMEib.envhh:mm AM/PMas beforeAUTO_LOGOFF_TIMEIBKR_AUTO_LOGOFF_TIMEib.env10:23 AM; the instance logs off at that time and the container then starts a fresh login. IfIBKR_AUTO_RESTART_TIMEis also set, auto restart winsTWS_COLD_RESTARTIBC_COLD_RESTART_TIMEib.envHH:MM24-hour, every Sunday, as beforeTWS_ACCEPT_INCOMINGIBKR_ACCEPT_INCOMING_CONNECTIONSib.envmanual,acceptorreject; not yet checked on a live runSAVE_TWS_SETTINGSEXISTING_SESSION_DETECTED_ACTIONIBC_EXISTING_SESSION_ACTIONib.envprimary; the default of ibcontroller itself ismanual, so set itALLOW_BLIND_TRADINGIBKR_BLIND_TRADINGib.envoff/on(yes/noaccepted); not yet checked on a live runTWS_MASTER_CLIENT_IDIBKR_MASTER_API_CLIENT_IDib.envJAVA_HEAP_SIZEIBC_JAVA_HEAP_SIZEib.env1024becomes1024mCUSTOM_CONFIGconfig.iniis no longer rendered or read, see "Volume warnings"TIME_ZONETZ.envTIME_ZONEis no longer read. A setup that only setsTIME_ZONEsilently falls back toEtc/UTCTZTZ.envTZfromTIME_ZONE; it now readsTZdirectly. Optional overrideIBC_TIME_ZONEinib.envTWS_SETTINGS_PATHIBC_TWS_SETTINGS_PATH.env.env, in the composeenvironment:block and in the volume target together;bothmode still adds_liveand_paper. Default:/home/ibgateway/tws_settingson Gateway,/config/tws_settingson TWSPUIDPUID.envPGIDPGID.envRDP_PASSWORDRDP_PASSWORD.envRDP_PASSWORD_FILERDP_PASSWORD_FILE.envVNC_SERVER_PASSWORDVNC_SERVER_PASSWORD.envVNC_SERVER_PASSWORD_FILEVNC_SERVER_PASSWORD_FILE.envSSH_TUNNELSSH_TUNNEL.envSSH_OPTIONSSSH_OPTIONS.envSSH_ALIVE_INTERVALSSH_ALIVE_INTERVAL.envSSH_ALIVE_COUNTSSH_ALIVE_COUNT.envSSH_PASSPHRASESSH_PASSPHRASE.envSSH_PASSPHRASE_FILESSH_PASSPHRASE_FILE.envSSH_REMOTE_PORTSSH_REMOTE_PORT.envSSH_USER_TUNNELSSH_USER_TUNNEL.envSSH_RESTARTSSH_RESTART.envSSH_VNC_PORTSSH_VNC_PORT.envSSH_RDP_PORTSSH_RDP_PORT.envSTART_SCRIPTSSTART_SCRIPTS.envX_SCRIPTSX_SCRIPTS.envIBC_SCRIPTSIBC_SCRIPTS.envThree rules a user hits first:
ib.envor.envis ignored without an error, so the setting is lost. For exampleIBC_READ_ONLY_APIis ignored,IBKR_READ_ONLY_APIis read.IBKR_*is reserved for ibcontroller. Do not setIBKR_SOCKET_PORTin this image: the ports are fixed by socat and the ssh tunnel.If you mounted your own IBC
config.ini, the full table of IBC keys and their ibcontroller equivalents is in ibcontroller's Upgrading guide.Compose file changes
Ports,
restart:, image names and theghcr.iotags are unchanged.Both images:
env_file: [ib.env]is added.TWS_*,TWOFA_*and similarenvironment:lines are removed.TZ: ${TZ:-Etc/UTC}replaces theTIME_ZONE/TZpair.IBC_TWS_SETTINGS_PATHis added.stop_grace_period: 30sis added. A clean ibcontroller shutdown can take longer than the 10 s Docker default. Keep it in custom compose files.tmpfsvolume entry for the ibcontrollerrun/directory withmode: 0o1777(YAML octal, not a bare1777).build.dockerfile: Dockerfilewithtarget: gatewayortarget: twsis used.Gateway only:
volumes:block is active now; it was commented out.USER_IDandUSER_GIDcome fromPUIDandPGID.TWS only:
Dockerfile.twsis replaced byDockerfilewithtarget: tws./dev/dridevices:block is commented out in the sample file. Add it back for GPU acceleration.For a custom compose file, add at least these lines to each service:
Volume warnings
New mount. The whole ibcontroller directory is mounted:
${PWD}/ibcontroller/to/home/ibgateway/ibcontrolleron Gateway, and inside/configon TWS. It must exist on the host and be owned byPUID:PGID(1000:1000 for the published Gateway image, because its user is fixed at build time). Do not mount only aconfig/subdirectory.run/stays a separate tmpfs.Gateway volumes are active. The Gateway sample compose used to keep its
volumes:block commented. It is now active, so create./ibcontrollerand./tws_settingsbefore the first start.Settings directory. The variable is renamed (see the table). With a custom
TWS_SETTINGS_PATH, an unrenamed variable sends settings to the new default path. Your mount may not cover it, and the settings are lost when the container is re-created. WithIBC_TRADING_MODE=both, Gateway needs separate_liveand_papermounts:jts.ini. The image no longer rendersjts.ini. ibcontroller creates it if missing and edits only the keys it owns (UseSSL,Locale,displayedproxymsg,s3store,TimeZone, andApiOnlyon Gateway). An existingjts.inion a volume is kept. The time zone fromTZnever overwrites an existingTimeZone. A mountedjts.inistill works.IBC
config.ini. A mounted IBCconfig.ini(/home/ibgateway/ibc/config.ini,/opt/ibc/config.ini) andCUSTOM_CONFIGhave no effect. Move those settings toib.envor toibcontroller.tomlon the ibcontroller volume.Earlier ibcontroller preview. Only if you ran the earlier ibcontroller preview image: a flat
ibcontroller.tomlfrom ibcontroller 0.1.x makes ibcontroller exit with code 78, and anibkr_settings.tomlis never read. See Upgrading.md.What ibcontroller v0.2 does not cover
These items are known. If you need any of them, stay on the IBC image (see "Stay on the IBC image").
Not implemented:
TWOFA_DEVICE) is not in v0.2.0. It needs a new agent command and is planned for ibcontroller v0.2.1.SAVE_TWS_SETTINGS(IBCSaveTwsSettingsAt) is not in v0.2.0.Known problems and unverified settings:
IBKR_SEND_MARKET_DATA_IN_LOTS_US_STOCKS=trueorIBKR_API_PRECAUTIONS_BYPASS_ROUTE_MARKETABLE_TO_BBO=trueopens a confirmation window that is not handled. Do not set them to true.falseis safe.IBKR_PASSWORD_EXPIRY_WARNING,IBKR_BLIND_TRADING,IBKR_ACCEPT_INCOMING_CONNECTIONS,IBKR_CRYPTO_ORDER_CONFIRMATION.Details: ibcontroller known problems and Upgrading.md.
Behaviour that differs
IBC_EXISTING_SESSION_ACTION: the default of ibcontroller ismanual; the old compose default wasprimary.ib.env-distsetsprimary.IBC_TRADING_MODEdefaults topaper.IBC_COLD_RESTART_TIME,IBC_CLOSEDOWN_AT,IBC_RESTART_CAP,IBC_LOG_LEVEL. Seeib.env-dist.Questions
Reply in this discussion. Open an issue only for a reproducible bug.
All reactions