Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

docker-compose start "ERROR: No containers to start"

People also ask

Does docker compose restart failed containers?

no: Containers will not restart automatically. on-failure[:max-retries]: Restart the container if it exits with a non-zero exit code and provide a maximum number of attempts for the Docker daemon to restart the container.

Is docker compose deprecated?

Following the deprecation of Compose on Kubernetes, support for Kubernetes in the stack and context commands in the docker CLI is now marked as deprecated as well.


The issue here is that you haven't actually created the containers. You will have to create these containers before running them. You could use the docker-compose up instead, that will create the containers and then start them.

Or you could run docker-compose create to create the containers and then run the docker-compose start to start them.


The reason why you saw the error is that docker-compose start and docker-compose restart assume that the containers already exist.

If you want to build and start containers, use

docker-compose up

If you only want to build the containers, use

docker-compose up --no-start

Afterwards, docker-compose {start,restart,stop} should work as expected.

There used to be a docker-compose create command, but it is now deprecated in favor of docker-compose up --no-start.