Docker Community Forums

Share and learn in the Docker community.

Run a command from one container to another using the network in docker-compose file


I need to configure a vault container without overriding the normal behavior so i can’t use entrypoint or command directly in the container. My idea is to do it by using another client container which will connect to the vault container and run the configuration script.

So my question is how can i run a shell script from one container inside another that are connected with the same network in a docker-compose file ?

Thank you,

The containers should both be on the bridge network, which means the web container should be able to connect to the DB container by referring to it’s name. So if you have a web config file for your app, then for DB host you will use the name db1 . if you are using an older version of docker, then you should use --link.