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?
The docker run command creates a container from a given image and starts the container using a given command. It is one of the first commands you should become familiar with when starting to work with Docker.
Like it was mentioned, if you are already inside of a container, then just use ps -eaf command to see the running processes.
Running Commands in an Alternate Directory in a Docker Container. To run a command in a certain directory of your container, use the --workdir flag to specify the directory: docker exec --workdir /tmp container-name pwd.
The run command acts like docker run -ti in that it opens an interactive terminal to the container and returns an exit status matching the exit status of the process in the container. The docker compose start command is useful only to restart containers that were previously created, but were stopped.
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With