docker-compose run and exec: No container found

docker-compose is meant to run multi-container applications and is supposed to be used with docker-compose up. When you use docker-compose run, you make a special container that's not really meant for normal use.

Since docker-compose is just a wrapper around docker, you can still access this special container via the normal docker command:

docker exec docker_my-centos_run_1 bash

Otherwise I'd suggest start your container with docker-compose up. This makes it so that you can run the second bash in the way that you specified:

docker-compose exec my-centos bash

Note: I don't know if you can attach a TTY directly with docker-compose up, so you might need to run an extra docker-compose exec my-centos bash to get two TTYs.


you need to do "docker-compose up -d" then try ur commands