docker 如何进入已经退出的容器container: You cannot attach to a stopped container, start it first

it2025-08-29  5

docker 如何进入已经退出的容器container: You cannot attach to a stopped container, start it first

操作docker docker attach d6c45e8cc5f0

docker exec -it 03841e395ca0 bash

然后我获取了以下信息:

You cannot attach to a stopped container, start it first

 

解决办法:

docker ps -a 查看<container-name/ID>

启动已停止的现有容器

docker start <container-name/ID>

停止正在运行的容器

docker stop <container-name/ID>

然后登录到容器的交互式shell。

docker exec -it <container-name/ID> bash

 

最新回复(0)