How can I understand the role of “/bin/true” comma

2019-02-11 19:50发布

问题:

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

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?

回答1:

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.

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.

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

See: 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



标签: docker gitlab