Dockerfile CMD 执行多个命令

http://www.taopanfeng.com/2020/12/14/2020-12-14…11.22.57/



FROM adoptopenjdk/openjdk8:centos



#正确
#CMD /bin/sh -c “touch /a1 ; /bin/bash”



#错误,只执行前面一个
#CMD /bin/sh -c “/bin/bash ; touch /a1”



#正确
#CMD touch /a1 ; /bin/bash



#错误,只执行前面一个
#CMD /bin/bash ; touch /a1



docker build -f a -t a . ; docker rm -f a1 ; docker run –name a1 -itd a ; docker exec -it a1 bash





https://pkgs.alpinelinux.org/contents?file=top&path=&name=&branch=edge


Category docker