Running docker-compose up -d
I got the following error:
Starting cr-redis ...
Starting cr-rabbitmq ...
Starting cr-rabbitmq ... error
Starting cr-redis ... error
Starting cr-mysql ... error
ERROR: for cr-mysql Cannot start service mysql: container "ff36...1116": already exists
ERROR: for rabbitmq Cannot start service rabbitmq: container "3b6c...0aba": already exists
ERROR: for redis Cannot start service redis: container "e84f...df91": already exists
ERROR: for mysql Cannot start service mysql: container "ff36...1116": already exists
ERROR: Encountered errors while bringing up the project.
docker-compose ps
Name Command State Ports
----------------------------------------------------------------------------------------------------------------------------------
cr-mysql docker-entrypoint.sh mysqld Exit 255
cr-php-fpm /bin/sh -c /usr/sbin/php-f ... Exit 255 9000/tcp
cr-rabbitmq docker-entrypoint.sh rabbi ... Exit 255
cr-redis docker-entrypoint.sh redis ... Exit 255
cr-webserver nginx -g daemon off; Exit 255 0.0.0.0:15672->15672/tcp, 0.0.0.0:80->80/tcp, 0.0.0.0:9003->9003/tcp
How can I start again the container without recreating it? I just don't want to lose the data in the DB.
--------------- UPDATE --------------------
$ docker-compose stop
$ docker-compose start
Starting redis ... error
Starting rabbitmq ... error
Starting mysql ... error
Starting php-fpm ... error
Starting webserver ... error
ERROR: for rabbitmq Cannot start service rabbitmq: container "3b6c...0aba": already exists
ERROR: for mysql Cannot start service mysql: container "ff36...1116": already exists
ERROR: for redis Cannot start service redis: container "e84f...f91": already exists
ERROR: No containers to start
Your case is probably related to a bug that will be fixed in the 18.03
release. Some workarounds are proposed here:
docker-compose up
builds, (re)creates, starts, and attaches to containers for a service.
Since your images
are built and the containers
of your service have started, you can then use
docker-compose stop
anddocker-compose start
to start/stop your service. This is different from docker-compose down
which:
Stops containers and removes containers, networks, volumes, and images created by
up
.
Regarding the danger of losing your data if a container is removed, read about persistent storage and how to use volumes.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With