[root@ip-172-31-85-137 dockerfiles]# vi Dockerfile
[root@ip-172-31-85-137 dockerfiles]# cat Dockerfile
FROM ubuntu:16.04
LABEL name="Raj Gupta"
LABEL email="rajkumargupta14@gmail.com"
[root@ip-172-31-85-137 dockerfiles]# docker image build -t rajubuntu:5 .
Sending build context to Docker daemon 2.048kB
Step 1/3 : FROM ubuntu:16.04
---> 13c9f1285025
Step 2/3 : LABEL name="Raj Gupta"
---> Running in c1ac8890fb2f
Removing intermediate container c1ac8890fb2f
---> a289a8b99ae9
Step 3/3 : LABEL email="rajkumargupta14@gmail.com"
---> Running in b14012af0d42
Removing intermediate container b14012af0d42
---> c1ab7f6e0b23
Successfully built c1ab7f6e0b23
Successfully tagged rajubuntu:5
[root@ip-172-31-85-137 dockerfiles]# docker image ls
REPOSITORY TAG IMAGE ID CREATED SIZE
rajubuntu 5 c1ab7f6e0b23 50 seconds ago 119MB
rajubuntu 4 f16cb6673695 25 minutes ago 146MB
rajubuntu 3 31a9e63bc1ee 38 minutes ago 146MB
rajubuntu 2 09a779b278b9 About an hour ago 146MB
rajubuntu 1 13c9f1285025 3 weeks ago 119MB
ubuntu 16.04 13c9f1285025 3 weeks ago 119MB
[root@ip-172-31-85-137 dockerfiles]# docker image inspect rajubuntu:5
"Labels": {
"email": "rajkumargupta14@gmail.com",
"name": "Raj Gupta"
}
-------------------------------------------------------------------------------
[root@ip-172-31-85-137 dockerfiles]# vi Dockerfile
[root@ip-172-31-85-137 dockerfiles]# cat Dockerfile
FROM ubuntu:16.04
LABEL name="Raj Gupta"
LABEL email="rajkumargupta14@gmail.com"
ENV NAME raj
ENV PASS password
[root@ip-172-31-85-137 dockerfiles]# docker image build -t rajubuntu:6 .
Sending build context to Docker daemon 2.048kB
Step 1/5 : FROM ubuntu:16.04
---> 13c9f1285025
Step 2/5 : LABEL name="Raj Gupta"
---> Using cache
---> a289a8b99ae9
Step 3/5 : LABEL email="rajkumargupta14@gmail.com"
---> Using cache
---> c1ab7f6e0b23
Step 4/5 : ENV NAME raj
---> Running in d3b63819ba08
Removing intermediate container d3b63819ba08
---> c7c7f71dc96c
Step 5/5 : ENV PASS password
---> Running in 93591c0824e7
Removing intermediate container 93591c0824e7
---> c8c5b5f76b30
Successfully built c8c5b5f76b30
Successfully tagged rajubuntu:6
[root@ip-172-31-85-137 dockerfiles]# docker container run -it rajubuntu:6
root@3ce98958a416:/# env
PASS=password
HOSTNAME=3ce98958a416
TERM=xterm
NAME=raj
------------------------------------------------------------------------------------
[root@ip-172-31-85-137 dockerfiles]# vi Dockerfile
[root@ip-172-31-85-137 dockerfiles]# cat Dockerfile
FROM ubuntu:16.04
LABEL name="Raj Gupta"
LABEL email="rajkumargupta14@gmail.com"
ENV NAME raj
ENV PASS password
RUN pwd>/tmp/1st.txt
RUN cd /tmp/
RUN pwd>tmp/2nd.txt
[root@ip-172-31-85-137 dockerfiles]# docker image build -t rajubuntu:7 .
Sending build context to Docker daemon 2.048kB
Step 1/8 : FROM ubuntu:16.04
---> 13c9f1285025
Step 2/8 : LABEL name="Raj Gupta"
---> Using cache
---> a289a8b99ae9
Step 3/8 : LABEL email="rajkumargupta14@gmail.com"
---> Using cache
---> c1ab7f6e0b23
Step 4/8 : ENV NAME raj
---> Using cache
---> c7c7f71dc96c
Step 5/8 : ENV PASS password
---> Using cache
---> c8c5b5f76b30
Step 6/8 : RUN pwd>/tmp/1st.txt
---> Running in add60b90516f
Removing intermediate container add60b90516f
---> 006e5460add7
Step 7/8 : RUN cd /tmp/
---> Running in d510bd713aeb
Removing intermediate container d510bd713aeb
---> f4fc9d2ae8f4
Step 8/8 : RUN pwd>tmp/2nd.txt
---> Running in 5d78620e573b
Removing intermediate container 5d78620e573b
---> 69217d97a681
Successfully built 69217d97a681
Successfully tagged rajubuntu:7
[root@ip-172-31-85-137 dockerfiles]# docker container run -it rajubuntu:7
root@1d3ed6096e9b:/# cd tmp
root@1d3ed6096e9b:/tmp# ls
1st.txt 2nd.txt
root@1d3ed6096e9b:/tmp# cat 1st.txt
/
root@1d3ed6096e9b:/tmp# cat 2nd.txt
/
root@1d3ed6096e9b:/tmp#
-------------------------------------------------------------------------------------------------
[root@ip-172-31-85-137 dockerfiles]# vi Dockerfile
[root@ip-172-31-85-137 dockerfiles]# cat Dockerfile
FROM ubuntu:16.04
LABEL name="Raj Gupta"
LABEL email="rajkumargupta14@gmail.com"
ENV NAME raj
ENV PASS password
RUN pwd>/tmp/1st.txt
RUN cd /tmp/
RUN pwd>tmp/2nd.txt
WORKDIR /tmp
RUN pwd>/tmp/3rd.txt
[root@ip-172-31-85-137 dockerfiles]# docker image build -t rajubuntu:8 .
Sending build context to Docker daemon 2.048kB
Step 1/10 : FROM ubuntu:16.04
---> 13c9f1285025
Step 2/10 : LABEL name="Raj Gupta"
---> Using cache
---> a289a8b99ae9
Step 3/10 : LABEL email="rajkumargupta14@gmail.com"
---> Using cache
---> c1ab7f6e0b23
Step 4/10 : ENV NAME raj
---> Using cache
---> c7c7f71dc96c
Step 5/10 : ENV PASS password
---> Using cache
---> c8c5b5f76b30
Step 6/10 : RUN pwd>/tmp/1st.txt
---> Using cache
---> 006e5460add7
Step 7/10 : RUN cd /tmp/
---> Using cache
---> f4fc9d2ae8f4
Step 8/10 : RUN pwd>tmp/2nd.txt
---> Using cache
---> 69217d97a681
Step 9/10 : WORKDIR /tmp
---> Running in f3e6b4471ca6
Removing intermediate container f3e6b4471ca6
---> 71a0eaa3d0cb
Step 10/10 : RUN pwd>/tmp/3rd.txt
---> Running in 83417ed2c84d
Removing intermediate container 83417ed2c84d
---> 5985dfeffbbd
Successfully built 5985dfeffbbd
Successfully tagged rajubuntu:8
[root@ip-172-31-85-137 dockerfiles]# docker container run -it rajubuntu:8
root@4967807f35a2:/tmp# ls
1st.txt 2nd.txt 3rd.txt
root@4967807f35a2:/tmp# cat 3rd.txt
/tmp
root@4967807f35a2:/tmp# cat 1st.txt
/
root@4967807f35a2:/tmp# cat 2nd.txt
/
root@4967807f35a2:/tmp#
No comments:
Post a Comment