The document said that command is the command executed by default after the container is started.http://wiki.jikexueyuan.com/project/docker-technology-and-combat/yaml_file.html
command: bundle exec thin -p 3000
So, where is the container’s default execution command viewed?
Can you take the official nginx image of Docker Hub as an example?
https://hub.docker.com/r/library/nginx/
docker run nginx && docker ps --no-trunc
The command column is the command executed by default.If there is a Dockerfile, it is usually the last line.
CMD
OrENTRYPOINT
It isCMD commands can be
docker run
The following command overrides, but ENTRYPOINT’s does notWhether CMD or ENTRYPOINT has more than one Dockerfile, only the last one will be executed.
e.g :
nginx:stable-alpine DockerfileFor example, this (doc run-rmnginx: stable-alpine/bin/sh) you will find that nginx is not running
Command in docker-compose.yml is specified after docker run/bin/sh