How can I understand the role of “/bin/true” command in “docker run …” command?

前端 未结 1 500
粉色の甜心
粉色の甜心 2021-01-03 21:48

I am following this document to install gitlab docker image, and get confused with the command:

docker run --name gitlab_data genezys/gitlab:7         


        
1条回答
  •  礼貌的吻别
    2021-01-03 22:26

    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

    0 讨论(0)
提交回复
热议问题