Docker Community Forums

Share and learn in the Docker community.

Communicate Between Containers

Please help if you know. I am new to Docker

I am working on a project that uses 2 different types of Containers.

1. Apache Server Docker (From ubuntu)
Contains to be called shell scripts and python scripts
2. System Usage Docker (From ubuntu)
User enter interactive mode from here.

I am connecting both container’s network to host “–net host”, now I want to communicate between these 2 containers. Calling a script to start up from docker 2 (System usage Docker) inside docker 1, is it possible to do it directly without using share volume or ssh method?

For example, inside Docker 2 -it mode, I will do something like " from docker 1 execute ./docker_1.sh" then this script will be running in Docker 1

Thanks for whoever willing to help.

Both docker 1 & 2 will be running at background, Docker 1 is using -d mode.

No, is not possible.

Communication between containers is managed at operating system level and it depends on two factors: By default Docker daemon attaches all containers to docker0 bridge, providing network address translation for their communication. So it is mandatory that network topology can identify containers’ network.

Then how about from docker container to host?
In the container, calling a script in host.

Thanks for you reply, I understand Network will be the option, so giving each container an address and the communication protocol between them will be by ssh? And then how about from docker container to host?
In the container, calling a script in host.