因此,我似乎无法启动它或附加它:
$ 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
我有什么办法可以解决它吗?
答案 0 :(得分:3)
这可能与https://github.com/docker/docker/issues/7015有关吗?查看评论https://github.com/docker/docker/issues/7015#issuecomment-52522196以获取解决方法。
对于您的特定错误,您可以执行以下操作:
$ systemctl stop docker-17d34ecd8c24ffcc9392735710b56ee9bab1cc62237f152114017fe6f92c3fcb.scope
然后尝试再次启动容器。但是,如果您以交互方式将此容器作为bash shell运行,则无法启动它然后附加到它,因为shell将立即退出。您需要将-a
(附加)和-i
(交互式)添加到docker start
命令。