I have a docker-compose with some php, mysql and so on starting. After a few days, I cannot bring them down as everything stopps instead of mysql. It always gives me the following error:
ERROR: network docker_default has active endpoints
this is my docker-compose.yml
version: '2' services: php: build: php-docker/. container_name: php ports: - "9000:9000" volumes: - /var/www/:/var/www/ links: - mysql:mysql restart: always nginx: build: nginx-docker/. container_name: nginx links: - php - mysql:mysql environment: WORDPRESS_DB_HOST: mysql:3306 ports: - "80:80" volumes: - /var/log/nginx:/var/log/nginx - /var/www/:/var/www/ - /var/logs/nginx:/var/logs/nginx - /var/config/nginx/certs:/etc/nginx/certs - /var/config/nginx/sites-enabled:/etc/nginx/sites-available restart: always mysql: build: mysql-docker/. container_name: mysql volumes: - /var/mysql:/var/lib/mysql environment: MYSQL_ROOT_PASSWORD: pw MYSQL_USER: florian MYSQL_PASSWORD: pw MYSQL_DATABASE: database restart: always phpmyadmin: build: phpmyadmin/. links: - mysql:db ports: - 1234:80 container_name: phpmyadmin environment: PMA_ARBITRARY: 1 PMA_USERNAME: florian PMA_PASSWORD: pw MYSQL_ROOT_PASSWORD: pw restart: always
docker network inspect docker_default
gives me:
[ { "Name": "docker_default", "Id": "1ed93da1a82efdab065e3a833067615e2d8b76336968a2591584af5874f07622", "Created": "2017-03-08T07:21:34.969179141Z", "Scope": "local", "Driver": "bridge", "EnableIPv6": false, "IPAM": { "Driver": "default", "Options": null, "Config": [ { "Subnet": "172.18.0.0/16", "Gateway": "172.18.0.1" } ] }, "Internal": false, "Attachable": false, "Containers": { "85985605f1c0c20e5ee9fedc95800327f782beafc0049f51e645146d2e954b7d": { "Name": "mysql", "EndpointID": "84fb19cd428f8b0ba764b396362727d9809cd1cfea536e648bfc4752c5cb6b27", "MacAddress": "02:42:ac:12:00:03", "IPv4Address": "172.18.0.3/16", "IPv6Address": "" } }, "Options": {}, "Labels": {} } ]
Seems that docker rm mysql -f
stopped the mysql container, but the network is running.
Removed the network with docker network disconnect -f docker_default mysql
But I'm pretty interested in how I got into this situation. any ideas?
Options. Remove containers for services not defined in the Compose file. Remove named volumes declared in the volumes section of the Compose file and anonymous volumes attached to containers.
Stops containers and removes containers, networks, volumes, and images created by up .
The docker-compose down command helps to Stop and remove containers, networks, images, and volumes.
We can simply get the ids of the containers with the command docker ps -aq, then by using the docker rm command, we can remove all the containers in the docker-machine.
I'm guessing you edited the docker-compose file while you were currently running...?
Sometimes if you edit the docker-compose file before doing a docker-compose down
it will then have a mismatch in what docker-compose will attempt to stop. First run docker rm 8598560
to stop the currently running container. From there, make sure you do a docker-compose down
before editing the file. Once you stop the container, docker-compose up
should work.
I resolved a similar problem when I added this after rename services in by docker-compose.yml file before stop container
docker-compose down --remove-orphans
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