{"id":17377209,"url":"https://github.com/extrange/ibkr-docker","last_synced_at":"2026-03-04T10:03:57.529Z","repository":{"id":45222691,"uuid":"426680943","full_name":"extrange/ibkr-docker","owner":"extrange","description":"Run IBKR Gateway/TWS in a Docker container","archived":false,"fork":false,"pushed_at":"2026-02-22T17:10:44.000Z","size":345,"stargazers_count":323,"open_issues_count":9,"forks_count":59,"subscribers_count":8,"default_branch":"master","last_synced_at":"2026-02-22T21:58:55.110Z","etag":null,"topics":["algorithmic-trading","docker","ibgateway","ibkr","quant","quantitative-finance","trading","trading-bot","tws","tws-api"],"latest_commit_sha":null,"homepage":"","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/extrange.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":"FUNDING.yml","license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null},"funding":{"github":["extrange"]}},"created_at":"2021-11-10T15:44:21.000Z","updated_at":"2026-02-18T08:49:39.000Z","dependencies_parsed_at":"2023-09-27T13:52:19.710Z","dependency_job_id":"f212c426-ce4d-4c62-8d57-1c5f4e73858d","html_url":"https://github.com/extrange/ibkr-docker","commit_stats":null,"previous_names":[],"tags_count":268,"template":false,"template_full_name":null,"purl":"pkg:github/extrange/ibkr-docker","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/extrange%2Fibkr-docker","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/extrange%2Fibkr-docker/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/extrange%2Fibkr-docker/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/extrange%2Fibkr-docker/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/extrange","download_url":"https://codeload.github.com/extrange/ibkr-docker/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/extrange%2Fibkr-docker/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30078307,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-04T08:01:56.766Z","status":"ssl_error","status_checked_at":"2026-03-04T08:00:42.919Z","response_time":59,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["algorithmic-trading","docker","ibgateway","ibkr","quant","quantitative-finance","trading","trading-bot","tws","tws-api"],"created_at":"2024-10-16T05:01:03.826Z","updated_at":"2026-03-04T10:03:57.503Z","avatar_url":"https://github.com/extrange.png","language":"Shell","readme":"# Interactive Brokers in Docker\n\n\u003c!--ts--\u003e\n\n- [Interactive Brokers in Docker](#interactive-brokers-in-docker)\n  - [Features](#features)\n  - [Getting Started](#getting-started)\n    - [Using `docker run`](#using-docker-run)\n    - [Using `docker compose` (recommended)](#using-docker-compose-recommended)\n    - [Environment Variables](#environment-variables)\n  - [Docker Images](#docker-images)\n  - [FAQ](#faq)\n    - [How do I save TWS settings locally?](#how-do-i-save-tws-settings-locally)\n    - [Cannot connect to API when using TWS](#cannot-connect-to-api-when-using-tws)\n    - [Error: `library initialization failed - unable to allocate file descriptor table - out of memory/root/ibc/scripts/ibcstart.sh`](#error-library-initialization-failed---unable-to-allocate-file-descriptor-table---out-of-memoryrootibcscriptsibcstartsh)\n    - [Which tag to use, `latest` or `stable`?](#which-tag-to-use-latest-or-stable)\n    - [What is the difference between IB Gateway and Trader Workstation (TWS)?](#what-is-the-difference-between-ib-gateway-and-trader-workstation-tws)\n    - [Do I need to download TWS separately?](#do-i-need-to-download-tws-separately)\n    - [What ports does TWS/IB Gateway use internally?](#what-ports-does-twsib-gateway-use-internally)\n    - [How do I configure the default login to paper/live trading?](#how-do-i-configure-the-default-login-to-paperlive-trading)\n  - [Repository Architecture](#repository-architecture)\n\n\u003c!-- Created by https://github.com/ekalinin/github-markdown-toc --\u003e\n\u003c!-- Added by: user, at: Wed Apr 19 10:30:30 PM +08 2023 --\u003e\n\n\u003c!--te--\u003e\n\n**Trader Workstation**\n\n![](tws.jpg)\n\n**IB Gateway**\n\n![](ibgateway.jpg)\n\n## Features\n\n- **Fully containerized** TWS/IB Gateway, no external dependencies\n- [**TWS API access**][tws-api] automatically configured and forwarded\n- **Viewable in a browser** (via noVNC)\n- **Auto-restart, auto-login** TWS/IB Gateway automatically via [IBC Alpha](https://github.com/IbcAlpha)\n\n## Getting Started\n\n### Using `docker run`\n\n```bash\ndocker run -d \\\n  -p \"127.0.0.1:6080:6080\" \\\n  -p \"127.0.0.1:8888:8888\" \\\n  --ulimit nofile=10000 \\\n  -e USERNAME=your_username \\\n  -e PASSWORD=your_password \\\n  ghcr.io/extrange/ibkr:latest\n```\n\n### Using `docker compose` (recommended)\n\nCreate a `.env` file:\n\n```bash\nUSERNAME=\u003cyour IBKR username\u003e\n# wrap password in single quotes if $, /, or \\ are present\nPASSWORD='\u003cyour IBKR password\u003e'\n```\n\n`compose.yml`:\n\n```yml\n---\nservices:\n  ibkr:\n    image: ghcr.io/extrange/ibkr # latest, stable, 10.21, 10.21.1p etc\n    ports:\n      - \"127.0.0.1:6080:6080\" # noVNC browser access\n      - \"127.0.0.1:8888:8888\" # API access\n    ulimits:\n      nofile: 10000 # See FAQ\n    environment:\n      USERNAME: ${USERNAME}\n      PASSWORD: ${PASSWORD}\n      # TWOFA_TIMEOUT_ACTION: restart\n      # GATEWAY_OR_TWS: tws\n      #\n      # Variables prefixed with IBC_ override IBCAlpha`s config.ini:\n      # IBC_TradingMode: live\n      # IBC_ReadOnlyApi: yes\n      # ...\n      # See below for more details\n```\n\n**Important**: Boolean-like values (e.g. `yes`/`no`) must be wrapped in single quotes to prevent them from being interpreted as `True`/`False` by th YAML parser.\n\nView at [localhost:6080](http://localhost:6080).\n\n[TWS API][tws-api] is accessible at port `8888`.\n\n### Environment Variables\n\n| Variable               | Description                                                      | Default    |\n|------------------------|------------------------------------------------------------------|------------|\n| `USERNAME`             | Username                                                         | `edemo`    |\n| `PASSWORD`             | Password                                                         | `demouser` |\n| `GATEWAY_OR_TWS`       | What to start, either `tws` or `gateway`                         | `tws`      |\n| `TWOFA_TIMEOUT_ACTION` | [2FA timeout action][twofa-timeout]. Either `restart` or `exit`. | `restart`  |\n| `TWS_SETTINGS_PATH`    | (optional) Path to store TWS settings (see FAQ)                  |            |\n\nVariables prefixed with `IBC_` will override settings in [IBCAlpha][ibc-alpha]'s `config.ini`, e.g.:\n\n- `IBC_TradingMode` (default: `live`)\n- `IBC_ExistingSessionDetectedAction` (default: `manual`)\n- `IBC_ReadOnlyApi` (default: keep existing)\n- etc.\n\nSee possible values [here][config.ini].\n\n## Docker Images\n\nSee available tags and versions [here.][images]\n\n## FAQ\n\n### How do I save TWS settings locally?\n\nIf you want to save TWS settings locally (e.g. to persist settings across container runs), set `TWS_SETTINGS_PATH` to say, `/settings`. Then, add a bind mount on your local filesystem, such as in the following `compose.yml`:\n\n```yaml\n#...\n  environment:\n    TWS_SETTINGS_PATH: /settings\n    #...\n  volumes:\n    - ./settings:/settings:rw\n```\n\nNow, TWS will load settings from your local filesystem for each container run.\n\n### Cannot connect to API when using TWS\n\nYou will need to manually enable `Enable ActiveX and Socket Clients` (see this [issue][tws-api-issue]).\n\n### Error: `library initialization failed - unable to allocate file descriptor table - out of memory/root/ibc/scripts/ibcstart.sh`\n\nEnsure that you have the appropriate `ulimit nofile` set: either `--ulimit nofile=10000` (`docker run`) or `ulimits: nofile: 10000` (`docker compose`).\n\n### Which tag to use, `latest` or `stable`?\n\n`stable` is generally [preferred][stable-or-latest] as there are less bugs.\n\n### What is the difference between IB Gateway and Trader Workstation (TWS)?\n\n[TWS][tws] is a fully featured trading platform with many features.\n\n[IB Gateway][ibgateway] has a minimal GUI and is used for API access to the trading platform, for example with automated trading. It also uses less resources.\n\nSee [here][tws-vs-gateway] for more differences.\n\n### Do I need to download TWS separately?\n\nBoth the IB Gateway and TWS installation scripts include both IB Gateway and TWS, so downloading either is fine.\n\n### What ports does TWS/IB Gateway use internally?\n\n[TWS uses `7496` (live) and `7497` (paper), while IB gateway uses `4001` (live) and `4002` (paper).][tws-ports]\n\nThere is no need to change the port for this image, as it automatically forwards the correct port (based on trading mode and TWS/IB Gateway) to 8888.\n\n### How do I configure the default login to paper/live trading?\n\nSet the environment variable `IBC_TradingMode` to `paper` or `live`.\n\n## Repository Architecture\n\n- New versions of IB Gateway are checked for daily, and fetched if available, as a release (`detect-releases.yml`).\n- A PR with the updated `Dockerfile` (obtained by running `build.sh \u003clatest/stable\u003e \u003cversion\u003e`) is automatically created\n- I test the updated configuration (both IB Gateway/TWS)\n- I then manually merge the PR, and tag the resulting commit with `git tag docker-\u003cversion\u003e-\u003clatest/stable\u003e`\n- Pushing the tag triggers a docker build action (`publish.yml`, based on the `docker-` prefix), which reads the version and release channel (latest/stable) from the tag, and then fetches the repo at the tag's commit, builds from the appropriate folder (latest/stable), tags and pushes the image to [ghcr.io/extrange/ibkr][images].\n\n[images]: https://github.com/extrange/ibkr-docker/pkgs/container/ibkr\n[tws-api]: https://interactivebrokers.github.io/tws-api/introduction.html\n[ibc-alpha]: https://github.com/IbcAlpha\n[config.ini]: https://github.com/IbcAlpha/IBC/blob/master/resources/config.ini\n[twofa-timeout]: https://github.com/IbcAlpha/IBC/blob/master/userguide.md#second-factor-authentication\n[stable-or-latest]: https://github.com/IbcAlpha/IBC/blob/master/userguide.md#interactive-brokers-trader-workstation\n[tws]: https://www.interactivebrokers.com/en/trading/tws.php\n[ibgateway]: https://www.interactivebrokers.com/en/trading/ibgateway-stable.php\n[tws-vs-gateway]: https://stackoverflow.com/questions/32778954/interactive-brokers-api-trader-workstation-tws-vs-ib-gateway\n[tws-ports]: https://www.interactivebrokers.com/en/?f=%2Fen%2Fgeneral%2Ftws-notes-954.php\n[tws-api-issue]: https://github.com/extrange/ibkr-docker/issues/16#issuecomment-1514830115\n","funding_links":["https://github.com/sponsors/extrange"],"categories":["Curated List"],"sub_categories":["API Integrations/Connectors"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fextrange%2Fibkr-docker","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fextrange%2Fibkr-docker","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fextrange%2Fibkr-docker/lists"}