Your Web News in One Place

Help Webnuz

Referal links:

Sign up for GreenGeeks web hosting
October 20, 2021 03:37 pm GMT

Running Docker Containers created using docker-compose

So, Recently I was experimenting with docker, and it occured to me that, how can I access the docker containers that are created using, docker-compose.

when I used, the docker ps -a command, I can see all my containers that are created by docker-compose.

docker ps -a result

But when I tried to run a container, It didn't run.

docker run result

The answer to this was quite simple.

1. To start a container use-

$ docker container start container_name

Note: The configuration specified for the container in the docker-compose file will be applied to the container by default so, you don't have to do them manually.

docker ps result

2. To stop a container use-

$ docker container stop container_name

3. To open up bash in the container use-

$ docker container exec -it container_name bashbash-5.1# 

And that's it!
Thanks for reading!
Have a marvelous day!


Original Link: https://dev.to/ankitbrijwasi/running-docker-containers-created-using-docker-compose-4lao

Share this article:    Share on Facebook
View Full Article

Dev To

An online community for sharing and discovering great ideas, having debates, and making friends

More About this Source Visit Dev To