unix – 删除使用`docker ps -f status = created`列出的Docker容器是否安全?

前端之家收集整理的这篇文章主要介绍了unix – 删除使用`docker ps -f status = created`列出的Docker容器是否安全?前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

我已经看过帖子显示如何删除用docker ps -q -f status = exited列出的已退出容器,但我还想清理’created’而不是’running’容器.删除具有“已创建”状态的容器是否安全,或者是否存在缺点?

最佳答案
具有已创建状态的Docker容器是从图像创建但从未启动的容器.删除它们没有任何影响,因为您不会在容器中运行任何进程并导致更改所创建容器的状态,在以后的情况下需要提交.这通常是为了加快启动容器并确保所有配置都准备就绪.

Refer Docker Docs

The 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.

原文链接:https://www.f2er.com/docker/435820.html

猜你在找的Docker相关文章