Home > Mobile >  How to make multiple independent attachments to the same docker container?
How to make multiple independent attachments to the same docker container?

Time:11-09

Maybe a trivial question but that's my problem:

I attached to a running docker container, after some use I needed to run a Unit Test and gdb at "the same time".

So I openned another shell tab (konsole tab) and attached again to the same docker container $ docker attach container_name but everything I did echoed in both attachments. If I execute cd /home/user/folder_foo the other tab will "do the same", ended up both konsole tabs in the same folder. Like the same command was echoed to both tabs. Maybe it's a unique user structure and what I isn't even possible.

I really need to do two thing in parallel in the same docker container, how it could be done?

$ docker --version
Docker version 20.10.9, build c2ea9bc

I am using Ubuntu 21.04

CodePudding user response:

Run multiple services in a container

It is generally recommended that you separate areas of concern by using one service per container. But for development purposes, you can follow mentioned guide.


Additionally, there is a similar answer already provided

You can run docker exec -it <container> bash from multiple terminals to launch several sessions connected to the same container.

  • Related