Communicate from the outside to the container launched by docker-compose

background

I wanted to paste a connection from another container to the DB container launched by docker-compose A memorandum of the procedure

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

Communicate from the outside to the container launched by docker-compose
Cannot communicate in docker-compose container
[Docker] How to access the host from inside the container. http://host.docker.internal:
Check the contents by docker pull from ECR and start the container
[Note] How to restart the Windows container set up with docker-compose
The road from JavaScript to Java
Android development-WEB access (GET) Try to get data by communicating with the outside. ~
Investigate the replacement from Docker to Podman.
[Docker] Copy files from docker container to host
Android development-WEB access (POST) Try to communicate with the outside and send data. ~
[Rails] How to decide the destination by "rails routes"
Migration from Eclipse to IntelliJ (on the way)
Add the JDK to the TeamCity build agent container
How to get a heapdump from a Docker container
Copy files from docker container to host (docker cp)
When you want to use the method outside
Get Enum by reverse lookup from the contents
Use the --build-arg option of docker-compose to pass environment variables to the container built with Dockerfile