I wanted to paste a connection from another container to the DB container launched by docker-compose A memorandum of the procedure
Check the network ID and Name launched by docker-compose with the following command
$ docker network ls
Execute by specifying the ID or Name obtained earlier with the docker run command with --net
$ docker run -it -v "$PWD":/path/to/dir --net <network ID or Name> <image name> <command>
Now you can connect with the specified network destination host or alias
Create an alias with --link if there is no host name
$ docker run -it -v "$PWD":/path/to/dir --net <network ID or Name> --link <container Name>:<host Name> <image name> <command>
Recommended Posts