Omroth
Omroth

Reputation: 1129

Printing to an interactive terminal inside a docker container from outside

I am running a Docker container with

docker run --name client_container -v ~/client/vol:/vol --network host -it --entrypoint '/bin/bash' --privileged client_image:latest -c "bash /execute/start_client.sh && /bin/bash"

I have a service on the host machine and I would like it to be able to print something to the interactive bash terminal at an arbitrary time. Is this possible?

Upvotes: 0

Views: 217

Answers (1)

David Maze
David Maze

Reputation: 159382

No, you can't do this.

In general it's difficult at best to write things to other terminal windows; Docker adding an additional layer of isolation makes this pretty much impossible. The docker run -t option means there probably is a special device file inside the container that could reach that terminal session, but since the host and container filesystems are isolated from each other, a host process can't access it at all.

Upvotes: 1

Related Questions