Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can a container with STATUS "Exited (-1)" be fixed?

Tags:

docker

As a result I can't seem to start it or attach to it:

$ sudo docker ps -a
CONTAINER ID        IMAGE                COMMAND             CREATED             STATUS                        PORTS               NAMES
17d34ecd8c24        ubuntu:latest        "bash"              2 hours ago         Exited (-1) 27 minutes ago                        fervent_kowalevski  
...

$ sudo docker start 17d34ecd8c24
Error response from daemon: Cannot start container 17d34ecd8c24: [8] System error: Unit docker-17d34ecd8c24ffcc9392735710b56ee9bab1cc62237f152114017fe6f92c3fcb.scope already exists.
FATA[0000] Error: failed to start one or more containers

$ sudo docker attach 17d34ecd8c24
FATA[0000] You cannot attach to a stopped container, start it first

Is there anything I can do to fix it?

like image 527
acros Avatar asked Apr 29 '15 19:04

acros


1 Answers

Could this be related to https://github.com/docker/docker/issues/7015? Check out comment https://github.com/docker/docker/issues/7015#issuecomment-52522196 for a workaround.

For your particular error, you would do something like:

$ systemctl stop docker-17d34ecd8c24ffcc9392735710b56ee9bab1cc62237f152114017fe6f92c3fcb.scope

Then try to start the container again. However, if you were running this container as a bash shell interactively, you won't be able to start it and then attach to it, as the shell will immediately exit. You will need to add -a (attach) and -i (interactive) to the docker start command.

like image 150
Andy Shinn Avatar answered Nov 15 '22 00:11

Andy Shinn