我已经看过帖子显示如何删除用docker ps -q -f status = exited列出的已退出容器,但我还想清理’created’而不是’running’容器.删除具有“已创建”状态的容器是否安全,或者是否存在缺点?
最佳答案
具有已创建状态的Docker容器是从图像创建但从未启动的容器.删除它们没有任何影响,因为您不会在容器中运行任何进程并导致更改所创建容器的状态,在以后的情况下需要提交.这通常是为了加快启动容器并确保所有配置都准备就绪.
原文链接:https://www.f2er.com/docker/435820.htmlThe docker create command creates a writeable container layer over the
specified image and prepares it for running the specified command. The
container ID is then printed to STDOUT. This is similar to docker run
-d except the container is never started. You can then use the docker start command to start the container at any point.This is useful when you want to set up a container configuration ahead
of time so that it is ready to start when you need it. The initial
status of the new container is created.