docker run nginx && docker ps --no-trunc The command column is the command that is executed by default
If there is a Dockerfile, usually the last line CMD 或 ENTRYPOINT is it
CMD commands can be overwritten by docker run following commands, but ENTRYPOINT will not
Regardless of CMD or ENTRYPOINT, when there are multiple entries in the same Dockerfile, only the last one will be executed
e.g : nginx:stable-alpine Dockerfile
For example, this (docker run --rm nginx:stable-alpine /bin/sh) you will find that nginx is not running The command in docker-compose.yml is the one specified after docker run /bin/sh
docker run nginx && docker ps --no-trunc
The command column is the command that is executed by defaultIf there is a Dockerfile, usually the last line
CMD
或ENTRYPOINT
is itCMD commands can be overwritten by
docker run
following commands, but ENTRYPOINT will notRegardless of CMD or ENTRYPOINT, when there are multiple entries in the same Dockerfile, only the last one will be executed
e.g :
nginx:stable-alpine Dockerfile
For example, this (docker run --rm nginx:stable-alpine /bin/sh) you will find that nginx is not running
The command in docker-compose.yml is the one specified after docker run
/bin/sh