0 1 2 3 4 |
$ cat Dockerfile FROM centos LABEL MAINTAINER="root@t4x.org" ENV name Docker ENTRYPOINT echo "hello, $name" |
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
docker build -t yypiaoling/centos-entrypoint-shell . $ docker build -t yypiaoling/centos-entrypoint-shell . Sending build context to Docker daemon 2.048kB Step 1/4 : FROM centos ---> 49f7960eb7e4 Step 2/4 : LABEL MAINTAINER="root@t4x.org" ---> Using cache ---> d821a4302db7 Step 3/4 : ENV name Docker ---> Running in 4a974c805a53 Removing intermediate container 4a974c805a53 ---> 47e2186120f4 Step 4/4 : ENTRYPOINT echo "hello, $name" ---> Running in 32f7e31202fc Removing intermediate container 32f7e31202fc ---> b97c88dfeeb9 Successfully built b97c88dfeeb9 Successfully tagged yypiaoling/centos-entrypoint-shell:latest [vagrant@vmdocker file]$ docker run yypiaoling/centos-entrypoint-shell hello, Docker [vagrant@vmdocker file]$ |
2:
0 1 2 3 4 |
$ cat Dockerfile FROM centos LABEL MAINTAINER="root@t4x.org" ENV name Docker ENTRYPOINT ["/bin/echo", "hello, $name"] |
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
$ docker build -t yypiaoling/centos-entrypoint-exec . Sending build context to Docker daemon 2.048kB Step 1/4 : FROM centos ---> 49f7960eb7e4 Step 2/4 : LABEL MAINTAINER="root@t4x.org" ---> Using cache ---> d821a4302db7 Step 3/4 : ENV name Docker ---> Using cache ---> 47e2186120f4 Step 4/4 : ENTRYPOINT ["/bin/echo", "hello, $name"] ---> Running in 4053cf61c48f Removing intermediate container 4053cf61c48f ---> d1b8ddc01a11 Successfully built d1b8ddc01a11 Successfully tagged yypiaoling/centos-entrypoint-exec:latest $ docker run yypiaoling/centos-entrypoint-exec hello, $name |
0 1 2 3 4 |
$ cat Dockerfile FROM centos LABEL MAINTAINER="root@t4x.org" ENV name Docker ENTRYPOINT ["/bin/bash", "-c", "/bin/echo hello, $name"] |
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
$ docker build -t yypiaoling/centos-entrypoint-exec-new .Sending build context to Docker daemon 2.048kB Step 1/4 : FROM centos ---> 49f7960eb7e4 Step 2/4 : LABEL MAINTAINER="root@t4x.org" ---> Using cache ---> d821a4302db7 Step 3/4 : ENV name Docker ---> Using cache ---> 47e2186120f4 Step 4/4 : ENTRYPOINT ["/bin/bash", "-c", "/bin/echo hello, $name"] ---> Running in c6e3a9c986e5 Removing intermediate container c6e3a9c986e5 ---> f363bfcd850f Successfully built f363bfcd850f Successfully tagged yypiaoling/centos-entrypoint-exec-new:latest |
0 1 |
$ docker run yypiaoling/centos-entrypoint-exec-new hello, Docker |
错误调试:
0 |
申明:除非注明Byrd's Blog内容均为原创,未经许可禁止转载!详情请阅读版权申明!