I was reading some of the Docker documentation and I've noticed that they pass the true command when they create a container.
$ sudo docker create -v /dbdata --name dbdata training/postgres /bin/true
Why are they passing /bin/true to the container? If I understand correctly, my data-only container is never running, so is that even necessary?
It is not necessary to run the command, but for right now Docker does require you to specify a command to run (or at least an entrypoint). I guess this is for schema-completeness reasons. The following command will create a docker container successfully:
docker create -v /dbdata --name dbdata --entrypoint=_ scratch
That container can be used as a volume container, but it can never run.
That said, many Docker utilities (such as Compose) expect a command to exist, because they will use run, not just create internally.
If you want to make very small containers for DVC purposes, use very small static binaries such as tianon/true.
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