CMD和ENTRYPOINT区别
https://www.bilibili.com/video/BV1og4y1q7M4?p=30
测试cmd命令
[root@iz8g9301trfnpxz dockerfile]# cat dockerfile-cmd-test
FROM centos
CMD ["ls","-a"]
构建镜像,执行
[root@iz8g9301trfnpxz /]# ls
bin boot dev etc home lib lib64 lost+found media mnt opt proc root run sbin srv sys tmp usr var
[root@iz8g9301trfnpxz /]# cd /home/dockerfile/
[root@iz8g9301trfnpxz dockerfile]# ls
mydocker-centos
[root@iz8g9301trfnpxz dockerfile]# vim dockerfile-cmd-test
[root@iz8g9301trfnpxz dockerfile]# docker build -f dockerfile-cmd-test -t cmdtest .
Sending build context to Docker daemon 3.072kB
Step 1/2 : FROM centos
---> 831691599b88
Step 2/2 : CMD ["ls","-a"]
---> Running in e6dca2412833
Removing intermediate container e6dca2412833
---> cef9ed46536a
Successfully built cef9ed46536a
Successfully tagged cmdtest:latest
[root@iz8g9301trfnpxz dockerfile]#
项目部署成功,可以直接访问ok!
我们以后开发步骤:需要掌握Dockerfile 我们以后都是使用docker镜像来发布的