Reputation: 247
My docker container can't restart after I upgrade the docker to Docker version 17.06.2-ce. The error message and my compose file are following:
Starting wordpress ... error
Starting mysql ... error
ERROR: for wordpress Cannot start service wordpress: oci runtime error: container with id exists:
b3951fd8b599c273f39d3b29085d525828a92dabe518f42860ba6535d5edad6e
ERROR: for mysql Cannot start service mysql: oci runtime error: container with id exists: be9c3682bb66720c8015cfe9e9025c68a917204444e9b77f68b63d84f0469b71
======================
the docker compose file is:
services:
wordpress:
image: wordpress
restart: always
ports:
- 80:80
environment:
WORDPRESS_DB_PASSWORD: xxx
mysql:
image: mysql:5.7
restart: always
environment:
MYSQL_ROOT_PASSWORD: xxx
I have reboot the instance but not working. Need your help!
Upvotes: 20
Views: 39190
Reputation: 595
This is because the system was restarted abnormally and the container was left in a bad state. To find the state information:
find -name "b3951fd8b599c273f39d3b29085d525828a92dabe518f42860ba6535d5edad6e"
That should result in something like:
/run/docker/runtime-runc/moby/b3951fd8b599c273f39d3b29085d525828a92dabe518f42860ba6535d5edad6e
You can remove the state information with:
sudo rm -rf /run/docker/runtime-runc/moby/b3951fd8b599c273f39d3b29085d525828a92dabe518f42860ba6535d5edad6e/
Then start the container fresh with:
docker start b395
Then you should be up and running.
Upvotes: 19
Reputation: 1247
Sometimes I face the same error when I update the Docker version. You can stop (docker-compose down
) and then start the container again. I think it is due to some runtime conflicts when adapting to the newer version.
Upvotes: 8
Reputation: 841
There is a documented bug for that specific version upgrade. The fix would be at https://github.com/docker/docker-ce/pull/117/files.
I haven't found the proper way to upgrade to 17.06+ under my environment, but you can get your containers running again. Try this:
$ docker start wp
Error response from daemon: oci runtime error: container with id exists: dc9c6a17c102747d81fbad674e93257a5b31f15e0837ed64b39c63eda5e6f46a
Error: failed to start containers: wp
$ docker start wp
wp
$ docker ps | grep wp
dc9c6a17c102 wordpress "docker-entrypoint..." 2 months ago Up 2 minutes 80/tcp wp
I've written about that on the Gentoo Forums (for my case) and on Github.
Upvotes: 3
Reputation: 10972
Have you tried to remove the stopped containers from your docker engine?
You can show all container with docker ps -a
. This will give you a list of the local containers (stopped and running). Identify the old wordpress and mysql containers and remove them with docker rm <container-id>
. After removing the old containers you should be able to run your docker compose file again.
Upvotes: 24