vim testCMD
FROM centos
CMD ["ls","-a"]
docker build -f testCMD -t testcmd:1.0
docker run $(docker images testcmd -q)
vim testENTRYPOINT
FROM centos
ENTRYPOINT ["ls","-a"]
docker build -f testENTRYPOINT -t testentrypoint:1.0
docker run $(docker images testentrypoint -q)
.
..
.dockerenv
bin
dev
etc
……
drwxr-xr-x 1 root root 4096 Mar 4 12:28 .
drwxr-xr-x 1 root root 4096 Mar 4 12:28 ..
-rwxr-xr-x 1 root root 0 Mar 4 12:28 .dockerenv
lrwxrwxrwx 1 root root 7 Nov 3 2020 bin -> usr/bin
drwxr-xr-x 5 root root 340 Mar 4 12:28 dev
drwxr-xr-x 1 root root 4096 Mar 4 12:28 etc
……
docker run $(docker images testcmd -q) ls -al
docker run $(docker images testentrypoint -q) -l
综上所述:CMD 是替换,ENTRYPOINT是拼接
|