Friday, 29 July 2022

dcoker-compose how to get into container

 ##########Go inside container #######

https://docs.docker.com/engine/reference/commandline/compose_exec/



Execute a command in a running container.

This is the equivalent of docker exec targeting a Compose service.

With this subcommand you can run arbitrary commands in your services. Commands are by default allocating a TTY, so you can use a command such as docker compose exec web sh to get an interactive prompt.



# execute running container name then get /bin/bash interactive prompt

docker-compose exec <container_name_through_ps> /bin/bash

# execute running container name thn get sh interactive prompt

docker-compose exec <container_name_through_ps> sh

No comments:

Post a Comment