问题描述
我正在关注这个 document 来安装 gitlab docker image
,然后对命令感到困惑:
I am following this document to install gitlab docker image
, and get confused with the command:
docker run --name gitlab_data genezys/gitlab:7.5.2 /bin/true
我知道/bin/true
"命令只是返回一个成功状态码,但是我怎么理解/bin/true
在这个中的作用docker run ...
命令?
I know "/bin/true
" command just returns a success status code, but how can I understand the role of /bin/true
in this docker run ...
command?
推荐答案
运行并因此创建一个新容器,即使它终止,仍然会保留生成的容器图像和元数据,这些图像和元数据仍然可以链接到.
Running and thus creating a new container even if it terminates still keeps the resulting container image and metadata lying around which can still be linked to.
因此,当您运行 docker run .../bin/true
时,您实际上是在创建一个用于存储目的的新容器并运行最简单的东西.
So when you run docker run ... /bin/true
you are essentially creating a new container for storage purposes and running the simplest thing you can.
在 Docker 1.5 中引入了 docker create
命令,因此我相信您现在可以创建"容器,而不会混淆地运行诸如 /bin/true
In Docker 1.5 was introduced the docker create
command so I believe you can now "create" containers without confusingly running something like /bin/true
请参阅:docker create
这是管理数据卷容器的新方法,在 创建和挂载数据卷容器
This is new method of managing data volume containers is also clearly documented in the section Creating and mounting a Data Volume Container
这篇关于如何理解“/bin/true"的作用?“docker run ..."中的命令命令?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!