ibeam icon indicating copy to clipboard operation
ibeam copied to clipboard

Multiple IBKR Accounts Login within One Single Docker Container

Open GG6666 opened this issue 3 years ago • 1 comments

I can login my 2 IBKR accounts simultaneously by running 2 separate docker containers with 2 different host ports 5000 and 5001 and same container port 5000. Is it possible for me to do that by running only one single docker container?

GG6666 avatar Sep 11 '22 01:09 GG6666

Technically it should be possible to run multiple instances of the IKBR gateway on one machine/container but IBeam is not setup for this. You'd have to make your own customer docker image.

JackD111 avatar Sep 12 '22 11:09 JackD111

Even I have this requirement wherein I have multiple users who would be firing ibkr trades through my app ... As of now, I am creating 1 container per user, as that looks like the only possible way .... is that correct ??

Is there any plan right now to support multiple ibkr users using 1 container ?

raj-crec avatar Oct 21 '22 13:10 raj-crec

Hey @raj-crec that's correct, 1 user per container. There is no plan to support multiple users using 1 container. To do so, IBeam would have to allow for a list of user credentials and potentially conf.yaml files to be provided, and then start and maintain an array of IBKR Gateways. While this sounds doable, I'd deem it an overly complex extension at this stage. If you can think of a reasonable way to get around it, feel free to submit a contribution though 👍

Voyz avatar Oct 21 '22 14:10 Voyz

Need one info ... what is the significance of host ports ?? If we are running multiple containers, can we not run them on different port numbers, like 5000, 5001 etc. ?? and, how can we provide host-port in the 'docker run ... ' command ??

raj-crec avatar Oct 25 '22 13:10 raj-crec

I'm not super versed in this, but for my logic: in context of Docker, the host is the computer system running your Docker and the containers within it. The Docker containers are like mini independent computer systems running within that host system. Therefore you map the TCP ports from within the containers to the host system, so that they could be used outside of the container.

You indeed can run multiple containers - for example instances of IBeam - mapped to different ports, like 5000, 5001.

Mapping a port in docker is done through the -p flag, ie. -p [CONTAINER_PORT]:[HOST_PORT], eg. -p 5000:6000. See https://docs.docker.com/config/containers/container-networking/

Voyz avatar Oct 26 '22 15:10 Voyz

I can login my 2 IBKR accounts simultaneously by running 2 separate docker containers with 2 different host ports 5000 and 5001 and same container port 5000. Is it possible for me to do that by running only one single docker container?

How did you do that? when I try to run the docker container on the same port (5000) I am getting an error that the port is being used.

Thanks, Amit

AmitKehat avatar Nov 04 '22 14:11 AmitKehat

As mentioned by Voyz above, you have to use 2 different host ports, but you can use the same container port of course coz both containers are separate systems in their own right .. I have not tried this but the guy above has, and even Voyz says it works, so my best guess is that it should !

raj-crec avatar Nov 11 '22 01:11 raj-crec

Is it possible that we can use the same container for many users, e.g. 1000 as in our web app we need to manage all those accounts and get the portfolio list for each users. Using 1 user per port would not be feasible i think.

indrarudia avatar Jan 10 '23 09:01 indrarudia

This would be quite a substantial expansion on what IBeam currently provides. At this time, I'm sorry to say but it is not possible

Voyz avatar Mar 18 '23 21:03 Voyz

I'm going to close this issue due to inactivity. Thanks for your contribution and please feel free to reopen if you'd like to continue the discussion 👍

Voyz avatar May 04 '23 19:05 Voyz