1. 程式人生 > >Dockerfile的ENV替換和轉義符

Dockerfile的ENV替換和轉義符

[[email protected] df]# docker build -t vker/df:0.1 .
Sending build context to Docker daemon  2.048kB
Step 1/12 : FROM busybox
---> 6ad733544a63
Step 2/12 : ENV box /hello
---> Running in d02799e03853
---> 42ce9cb6ff2d
Removing intermediate container d02799e03853
Step 3/12 : ENV a1 ${box}_a1
---> Running in 2da6572101ea
---> b0c48ad6493f
Removing intermediate container 2da6572101ea
Step 4/12 : ENV a2 $box_a1
---> Running in ecfcef134413
---> 01b1c31bafeb
Removing intermediate container ecfcef134413
Step 5/12 : ENV a3 $box
---> Running in 0b99c236d291
---> c23b77d0dc2b
Removing intermediate container 0b99c236d291
Step 6/12 : ENV a4 ${box}
---> Running in 857f46adaa4b
---> 96bc86cb4b4e
Removing intermediate container 857f46adaa4b
Step 7/12 : ENV a5 ${a1:-world}
---> Running in c2c28de1df9c
---> 6b06e0e7e3d2
Removing intermediate container c2c28de1df9c
Step 8/12 : ENV a6 ${a0:-world}
---> Running in d98a96c77096
---> 9ee5a36f5cff
Removing intermediate container d98a96c77096
Step 9/12 : ENV a7 ${a1:+world}
---> Running in cccb508fea54
---> 74e8b22013bc
Removing intermediate container cccb508fea54
Step 10/12 : ENV a8 ${a0:+world}
---> Running in ef18b0a3b373
---> 6a58987ed19b
Removing intermediate container ef18b0a3b373
Step 11/12 : ENV a9 \$box
---> Running in 8b58200ba08e
---> 98eb20ae4275
Removing intermediate container 8b58200ba08e
Step 12/12 : ENV a10 \${box}
---> Running in e885b683320e
---> 2a25e714317f
Removing intermediate container e885b683320e
Successfully built 2a25e714317f
Successfully tagged vker/df:0.1
[
[email protected]
df]# docker run -it vker/df:0.1 / # env HOSTNAME=da1714f4cec7 SHLVL=1 HOME=/root TERM=xterm a1=/hello_a1 PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin a2= a3=/hello a4=/hello a5=/hello_a1 box=/hello a6=world a7=world a8= a9=$box a10=${box} PWD=/