Creating Docker images

Some important docker commands  to revise

docker pull nginx
docker images
docker stop myweb
docker ps -a
docker ps
docker inspect myweb
docker exec -it myweb /bin/bash
docker inspect myweb |grep -i ipaddress
docker run -d –name=myweb1 -P nginx
docker port myweb1 $CONTAINERPORT
docker run –name=myweb nginx
docker run -d nginx
docker run -d -p 8080:80 nginx
docker stop insane_rosalind myweb1 myweb clever_babbage
docker rmi -f nginx
docker rm `docker ps -a -q`
########################
root@cloudshell:~$ vim Dockerfile
FROM
FROM debian:stable
MAINTAINER rafi494 <mohammedrafi494@gmail.com>
RUN apt-get update
RUN apt-get upgrade
root@cloudshell:~$ docker build -t rafi494/myapache .
Sending build context to Docker daemon 195.9 MB
Step 1 : FROM debian:stable
stable: Pulling from library/debian

6968f9a27d39: Pull complete
Digest: sha256:7df51c1c0a5d41f2731cfb45c21decc9c197faf7b6cddf61a5cb964d6db6fcea
Status: Downloaded newer image for debian:stable
—> 58cf158c4bd6
Step 2 : MAINTAINER rafi494 <mohammedrafi494@gmail.com>
—> Running in 5ac8a9f9d2ea
—> cafa751e15d9
Removing intermediate container 5ac8a9f9d2ea
Step 3 : RUN apt-get update
—> Running in 3ae31eebdca0
Get:1 http://security.debian.org stable/updates InRelease [63.1 kB]
Ign http://deb.debian.org stable InRelease
Get:2 http://deb.debian.org stable-updates InRelease [145 kB]
Get:3 http://security.debian.org stable/updates/main amd64 Packages [508 kB]
Get:4 http://deb.debian.org stable Release.gpg [2373 B]
Get:5 http://deb.debian.org stable-updates/main amd64 Packages [17.6 kB]
Get:6 http://deb.debian.org stable Release [148 kB]
Get:7 http://deb.debian.org stable/main amd64 Packages [9049 kB]
Fetched 9933 kB in 5s (1941 kB/s)
Reading package lists…
—> 501d03914510
Removing intermediate container 3ae31eebdca0
Step 4 : RUN apt-get upgrade
—> Running in 84cb277f07d5
Reading package lists…
Building dependency tree…
Reading state information…
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
—> 2573696460cd
Removing intermediate container 84cb277f07d5
Successfully built 2573696460cd
root@cloudshell:~$
root@cloudshell:~$ docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
rafi494/myapache latest 2573696460cd 50 seconds ago 133.3 MB

add RUN 
root@cloudshell:~$ vim Dockerfile
RUN apt-get install telnet

root@cloudshell:~$ docker build -t rafi494/myapache .
Sending build context to Docker daemon 195.9 MB
Step 1 : FROM debian:stable
—> 58cf158c4bd6
Step 2 : MAINTAINER rafi494 <mohammedrafi494@gmail.com>
—> Using cache
—> cafa751e15d9
Step 3 : RUN apt-get update
—> Using cache
—> 501d03914510
Step 4 : RUN apt-get upgrade
—> Using cache
—> 2573696460cd
Step 5 : RUN apt-get install telnet
—> Running in da222ddfa6a5
Reading package lists…
Building dependency tree…
Reading state information…
The following NEW packages will be installed:
telnet
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 71.8 kB of archives.
After this operation, 205 kB of additional disk space will be used.
Get:1 http://deb.debian.org/debian/ stable/main telnet amd64 0.17-36 [71.8 kB]
debconf: delaying package configuration, since apt-utils is not installed
Fetched 71.8 kB in 0s (134 kB/s)
Selecting previously unselected package telnet.
(Reading database … 7565 files and directories currently installed.)
Preparing to unpack …/telnet_0.17-36_amd64.deb …
Unpacking telnet (0.17-36) …
Setting up telnet (0.17-36) …
update-alternatives: using /usr/bin/telnet.netkit to provide /usr/bin/telnet (telnet) in auto mode
—> 7853381e39fe
Removing intermediate container da222ddfa6a5
Successfully built 7853381e39fe
root@cloudshell:~$

root@cloudshell:~$ docker rmi `docker ps -a -q` rafi494/myapache
Untagged: rafi494/myapache:latest
Deleted: sha256:7853381e39fe384b9d58d85b1039970bb41222b6c5e45096e0a4e16f82c61c37
Deleted: sha256:6c1347f0edc5a0ffa108906d0f2b01062fb5bf6c68798c030be230e0da01e7f9
Deleted: sha256:2573696460cd9e1541ac9248092c29306bc5bbe7c605944c999746aee1635f53
Deleted: sha256:b31405bb228a15a4ceed740b746d7566620fcb70c06bafd7f42ad6cfcd5df1d6
Deleted: sha256:501d039145100eb6bc02f68d64116d603f8051a5d1c73c249c6b5936bb3dccaa
Deleted: sha256:e53ffd5318396ef340b33fa1ca0603ba36d768fe7a82817ad0fe1187ff646f48
Deleted: sha256:cafa751e15d9507792728eed62b26ae279c529149aa087716546cea3e47fa612

root@cloudshell:~$ docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
root@cloudshell:~$ docker build -t rafi494/apache .
Sending build context to Docker daemon 195.9 MB
Step 1 : FROM debian:stable
—> 58cf158c4bd6
Step 2 : MAINTAINER rafi494 <mohammedrafi494@gmail.com>
—> Running in 2c34ce16d289
—> 7d33712d7521
Removing intermediate container 2c34ce16d289
Step 3 : RUN apt-get update
—> Running in 90081d97c0ee
Get:1 http://security.debian.org stable/updates InRelease [63.1 kB]
Ign http://deb.debian.org stable InRelease
Get:2 http://deb.debian.org stable-updates InRelease [145 kB]
Get:3 http://security.debian.org stable/updates/main amd64 Packages [508 kB]
Get:4 http://deb.debian.org stable Release.gpg [2373 B]
Get:5 http://deb.debian.org stable-updates/main amd64 Packages [17.6 kB]
Get:6 http://deb.debian.org stable Release [148 kB]
Get:7 http://deb.debian.org stable/main amd64 Packages [9049 kB]
Fetched 9933 kB in 7s (1400 kB/s)
Reading package lists…
—> 448be97dd2ec
Removing intermediate container 90081d97c0ee
Step 4 : RUN apt-get upgrade
—> Running in 117bc0f40690
Reading package lists…
Building dependency tree…
Reading state information…
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
—> 83bdf3d994da
Removing intermediate container 117bc0f40690
Step 5 : RUN apt-get install telnet
—> Running in 35b947a9e438
Reading package lists…
Building dependency tree…
Reading state information…
The following NEW packages will be installed:
telnet
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 71.8 kB of archives.
After this operation, 205 kB of additional disk space will be used.
Get:1 http://deb.debian.org/debian/ stable/main telnet amd64 0.17-36 [71.8 kB]
debconf: delaying package configuration, since apt-utils is not installed
Fetched 71.8 kB in 0s (161 kB/s)
Selecting previously unselected package telnet.
(Reading database … 7565 files and directories currently installed.)
Preparing to unpack …/telnet_0.17-36_amd64.deb …
Unpacking telnet (0.17-36) …
Setting up telnet (0.17-36) …
update-alternatives: using /usr/bin/telnet.netkit to provide /usr/bin/telnet (telnet) in auto mode
—> 6ec577bb8421
Removing intermediate container 35b947a9e438
Successfully built 6ec577bb8421

root@cloudshell:~$ docker build -t rafi494/apache .
Sending build context to Docker daemon 195.9 MB
Step 1 : FROM debian:stable
—> 58cf158c4bd6
Step 2 : MAINTAINER rafi494 <mohammedrafi494@gmail.com>
—> Using cache
—> 7d33712d7521
Step 3 : RUN apt-get update
—> Using cache
—> 448be97dd2ec
Step 4 : RUN apt-get upgrade
—> Using cache
—> 83bdf3d994da
Step 5 : RUN apt-get install telnet
—> Using cache
—> 6ec577bb8421
Successfully built 6ec577bb8421
root@cloudshell:~$ vim Dockerfile
FROM debian:stable
MAINTAINER rafi494 <mohammedrafi494@gmail.com>
RUN apt-get update -y && apt-get upgrade -y && apt-get install telnet elinks -y

root@cloudshell:~$ docker build -t rafi494/apache .
Sending build context to Docker daemon 196 MB
Step 1 : FROM debian:stable
—> 58cf158c4bd6
Step 2 : MAINTAINER rafi494 <mohammedrafi494@gmail.com>
—> Using cache
—> 7d33712d7521
Step 3 : RUN apt-get update -y && apt-get upgrade -y && apt-get install telnet elinks -y
—> Running in 24a272a3b4c8
Get:1 http://security.debian.org stable/updates InRelease [63.1 kB]
Ign http://deb.debian.org stable InRelease
Get:2 http://security.debian.org stable/updates/main amd64 Packages [508 kB]
Get:3 http://deb.debian.org stable-updates InRelease [145 kB]
Get:4 http://deb.debian.org stable Release.gpg [2373 B]
Get:5 http://deb.debian.org stable Release [148 kB]
Get:6 http://deb.debian.org stable-updates/main amd64 Packages [17.6 kB]
Get:7 http://deb.debian.org stable/main amd64 Packages [9049 kB]
Fetched 9933 kB in 3s (2646 kB/s)
Reading package lists…
Reading package lists…
Building dependency tree…
Reading state information…
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Reading package lists…
Building dependency tree…
Reading state information…
The following extra packages will be installed:
elinks-data krb5-locales libexpat1 libffi6 libfsplib0 libgmp10
libgnutls-deb0-28 libgpm2 libgssapi-krb5-2 libhogweed2 libidn11 libk5crypto3
libkeyutils1 libkrb5-3 libkrb5support0 libnettle4 libp11-kit0 libperl5.20
libtasn1-6 libtre5
Suggested packages:
elinks-doc gnutls-bin gpm krb5-doc krb5-user tre-agrep
The following NEW packages will be installed:
elinks elinks-data krb5-locales libexpat1 libffi6 libfsplib0 libgmp10
libgnutls-deb0-28 libgpm2 libgssapi-krb5-2 libhogweed2 libidn11 libk5crypto3
libkeyutils1 libkrb5-3 libkrb5support0 libnettle4 libp11-kit0 libperl5.20
libtasn1-6 libtre5 telnet
0 upgraded, 22 newly installed, 0 to remove and 0 not upgraded.
Need to get 5990 kB of archives.
After this operation, 12.8 MB of additional disk space will be used.
Get:1 http://deb.debian.org/debian/ stable/main libgmp10 amd64 2:6.0.0+dfsg-6 [253 kB]
Get:2 http://deb.debian.org/debian/ stable/main libnettle4 amd64 2.7.1-5+deb8u2 [176 kB]
Get:3 http://deb.debian.org/debian/ stable/main libhogweed2 amd64 2.7.1-5+deb8u2 [125 kB]
Get:4 http://deb.debian.org/debian/ stable/main libffi6 amd64 3.1-2+b2 [20.1 kB]
Get:5 http://deb.debian.org/debian/ stable/main libp11-kit0 amd64 0.20.7-1 [81.2 kB]
Get:6 http://deb.debian.org/debian/ stable/main libtasn1-6 amd64 4.2-3+deb8u2 [49.0 kB]
Get:7 http://deb.debian.org/debian/ stable/main libgnutls-deb0-28 amd64 3.3.8-6+deb8u4 [695 kB]
Get:8 http://deb.debian.org/debian/ stable/main libgpm2 amd64 1.20.4-6.1+b2 [34.0 kB]
Get:9 http://deb.debian.org/debian/ stable/main libkeyutils1 amd64 1.5.9-5+b1 [12.0 kB]
Get:10 http://deb.debian.org/debian/ stable/main libkrb5support0 amd64 1.12.1+dfsg-19+deb8u2 [59.1 kB]
Get:11 http://deb.debian.org/debian/ stable/main libk5crypto3 amd64 1.12.1+dfsg-19+deb8u2 [115 kB]
Get:12 http://deb.debian.org/debian/ stable/main libkrb5-3 amd64 1.12.1+dfsg-19+deb8u2 [303 kB]
Get:13 http://deb.debian.org/debian/ stable/main libgssapi-krb5-2 amd64 1.12.1+dfsg-19+deb8u2 [152 kB]
Get:14 http://deb.debian.org/debian/ stable/main libidn11 amd64 1.29-1+deb8u2 [136 kB]
Get:15 http://deb.debian.org/debian/ stable/main libexpat1 amd64 2.1.0-6+deb8u3 [80.0 kB]
Get:16 http://deb.debian.org/debian/ stable/main libtre5 amd64 0.8.0-4+deb8u1 [57.8 kB]
Get:17 http://deb.debian.org/debian/ stable/main krb5-locales all 1.12.1+dfsg-19+deb8u2 [2649 kB]
Get:18 http://deb.debian.org/debian/ stable/main telnet amd64 0.17-36 [71.8 kB]
Get:19 http://deb.debian.org/debian/ stable/main libfsplib0 amd64 0.11-2 [14.6 kB]
Get:20 http://deb.debian.org/debian/ stable/main libperl5.20 amd64 5.20.2-3+deb8u6 [1350 B]
Get:21 http://deb.debian.org/debian/ stable/main elinks-data all 0.12~pre6-5 [389 kB]
Get:22 http://deb.debian.org/debian/ stable/main elinks amd64 0.12~pre6-5+b2 [516 kB]
debconf: delaying package configuration, since apt-utils is not installed
Fetched 5990 kB in 6s (919 kB/s)
Selecting previously unselected package libgmp10:amd64.
(Reading database … 7565 files and directories currently installed.)
Preparing to unpack …/libgmp10_2%3a6.0.0+dfsg-6_amd64.deb …
Unpacking libgmp10:amd64 (2:6.0.0+dfsg-6) …
Selecting previously unselected package libnettle4:amd64.
Preparing to unpack …/libnettle4_2.7.1-5+deb8u2_amd64.deb …
Unpacking libnettle4:amd64 (2.7.1-5+deb8u2) …
Selecting previously unselected package libhogweed2:amd64.
Preparing to unpack …/libhogweed2_2.7.1-5+deb8u2_amd64.deb …
Unpacking libhogweed2:amd64 (2.7.1-5+deb8u2) …
Selecting previously unselected package libffi6:amd64.
Preparing to unpack …/libffi6_3.1-2+b2_amd64.deb …
Unpacking libffi6:amd64 (3.1-2+b2) …
Selecting previously unselected package libp11-kit0:amd64.
Preparing to unpack …/libp11-kit0_0.20.7-1_amd64.deb …
Unpacking libp11-kit0:amd64 (0.20.7-1) …
Selecting previously unselected package libtasn1-6:amd64.
Preparing to unpack …/libtasn1-6_4.2-3+deb8u2_amd64.deb …
Unpacking libtasn1-6:amd64 (4.2-3+deb8u2) …
Selecting previously unselected package libgnutls-deb0-28:amd64.
Preparing to unpack …/libgnutls-deb0-28_3.3.8-6+deb8u4_amd64.deb …
Unpacking libgnutls-deb0-28:amd64 (3.3.8-6+deb8u4) …
Selecting previously unselected package libgpm2:amd64.
Preparing to unpack …/libgpm2_1.20.4-6.1+b2_amd64.deb …
Unpacking libgpm2:amd64 (1.20.4-6.1+b2) …
Selecting previously unselected package libkeyutils1:amd64.
Preparing to unpack …/libkeyutils1_1.5.9-5+b1_amd64.deb …
Unpacking libkeyutils1:amd64 (1.5.9-5+b1) …
Selecting previously unselected package libkrb5support0:amd64.
Preparing to unpack …/libkrb5support0_1.12.1+dfsg-19+deb8u2_amd64.deb …
Unpacking libkrb5support0:amd64 (1.12.1+dfsg-19+deb8u2) …
Selecting previously unselected package libk5crypto3:amd64.
Preparing to unpack …/libk5crypto3_1.12.1+dfsg-19+deb8u2_amd64.deb …
Unpacking libk5crypto3:amd64 (1.12.1+dfsg-19+deb8u2) …
Selecting previously unselected package libkrb5-3:amd64.
Preparing to unpack …/libkrb5-3_1.12.1+dfsg-19+deb8u2_amd64.deb …
Unpacking libkrb5-3:amd64 (1.12.1+dfsg-19+deb8u2) …
Selecting previously unselected package libgssapi-krb5-2:amd64.
Preparing to unpack …/libgssapi-krb5-2_1.12.1+dfsg-19+deb8u2_amd64.deb …
Unpacking libgssapi-krb5-2:amd64 (1.12.1+dfsg-19+deb8u2) …
Selecting previously unselected package libidn11:amd64.
Preparing to unpack …/libidn11_1.29-1+deb8u2_amd64.deb …
Unpacking libidn11:amd64 (1.29-1+deb8u2) …
Selecting previously unselected package libexpat1:amd64.
Preparing to unpack …/libexpat1_2.1.0-6+deb8u3_amd64.deb …
Unpacking libexpat1:amd64 (2.1.0-6+deb8u3) …
Selecting previously unselected package libtre5:amd64.
Preparing to unpack …/libtre5_0.8.0-4+deb8u1_amd64.deb …
Unpacking libtre5:amd64 (0.8.0-4+deb8u1) …
Selecting previously unselected package krb5-locales.
Preparing to unpack …/krb5-locales_1.12.1+dfsg-19+deb8u2_all.deb …
Unpacking krb5-locales (1.12.1+dfsg-19+deb8u2) …
Selecting previously unselected package telnet.
Preparing to unpack …/telnet_0.17-36_amd64.deb …
Unpacking telnet (0.17-36) …
Selecting previously unselected package libfsplib0.
Preparing to unpack …/libfsplib0_0.11-2_amd64.deb …
Unpacking libfsplib0 (0.11-2) …
Selecting previously unselected package libperl5.20.
Preparing to unpack …/libperl5.20_5.20.2-3+deb8u6_amd64.deb …
Unpacking libperl5.20 (5.20.2-3+deb8u6) …
Selecting previously unselected package elinks-data.
Preparing to unpack …/elinks-data_0.12~pre6-5_all.deb …
Unpacking elinks-data (0.12~pre6-5) …
Selecting previously unselected package elinks.
Preparing to unpack …/elinks_0.12~pre6-5+b2_amd64.deb …
Unpacking elinks (0.12~pre6-5+b2) …
Setting up libgmp10:amd64 (2:6.0.0+dfsg-6) …
Setting up libnettle4:amd64 (2.7.1-5+deb8u2) …
Setting up libhogweed2:amd64 (2.7.1-5+deb8u2) …
Setting up libffi6:amd64 (3.1-2+b2) …
Setting up libp11-kit0:amd64 (0.20.7-1) …
Setting up libtasn1-6:amd64 (4.2-3+deb8u2) …
Setting up libgnutls-deb0-28:amd64 (3.3.8-6+deb8u4) …
Setting up libgpm2:amd64 (1.20.4-6.1+b2) …
Setting up libkeyutils1:amd64 (1.5.9-5+b1) …
Setting up libkrb5support0:amd64 (1.12.1+dfsg-19+deb8u2) …
Setting up libk5crypto3:amd64 (1.12.1+dfsg-19+deb8u2) …
Setting up libkrb5-3:amd64 (1.12.1+dfsg-19+deb8u2) …
Setting up libgssapi-krb5-2:amd64 (1.12.1+dfsg-19+deb8u2) …
Setting up libidn11:amd64 (1.29-1+deb8u2) …
Setting up libexpat1:amd64 (2.1.0-6+deb8u3) …
Setting up libtre5:amd64 (0.8.0-4+deb8u1) …
Setting up krb5-locales (1.12.1+dfsg-19+deb8u2) …
Setting up telnet (0.17-36) …
update-alternatives: using /usr/bin/telnet.netkit to provide /usr/bin/telnet (telnet) in auto mode
Setting up libfsplib0 (0.11-2) …
Setting up libperl5.20 (5.20.2-3+deb8u6) …
Setting up elinks-data (0.12~pre6-5) …
Setting up elinks (0.12~pre6-5+b2) …
Processing triggers for libc-bin (2.19-18+deb8u7) …
—> db7e59debdad
Removing intermediate container 24a272a3b4c8
Successfully built db7e59debdad
root@cloudshell:~$ docker build -t rafi494/apache .
Sending build context to Docker daemon 196 MB
Step 1 : FROM debian:stable
—> 58cf158c4bd6
Step 2 : MAINTAINER rafi494 <mohammedrafi494@gmail.com>
—> Using cache
—> 7d33712d7521
Step 3 : RUN apt-get update -y && apt-get upgrade -y && apt-get install telnet elinks -y
—> Using cache
—> db7e59debdad
Successfully built db7e59debdad

root@cloudshell:~$ vim Dockerfile
FROM debian:stable
MAINTAINER rafi494 <mohammedrafi494@gmail.com>
RUN apt-get update -y && apt-get upgrade -y && apt-get install telnet elinks apache2 -y
ENV MYVALUE 123
EXPOSE 80
EXPOSE 22

root@cloudshell:~$ docker build -t rafi494/apache .
Sending build context to Docker daemon 196 MB
Step 1 : FROM debian:stable
—> 58cf158c4bd6
Step 2 : MAINTAINER rafi494 <mohammedrafi494@gmail.com>
—> Using cache
—> 7d33712d7521
Step 3 : RUN apt-get update -y && apt-get upgrade -y && apt-get install telnet elinks apache2 -y
—> Running in dac446cc4624
Get:1 http://security.debian.org stable/updates InRelease [63.1 kB]
Ign http://deb.debian.org stable InRelease
Get:2 http://deb.debian.org stable-updates InRelease [145 kB]
Get:3 http://deb.debian.org stable Release.gpg [2373 B]
Get:4 http://security.debian.org stable/updates/main amd64 Packages [508 kB]
Get:5 http://deb.debian.org stable Release [148 kB]
Get:6 http://deb.debian.org stable-updates/main amd64 Packages [17.6 kB]
Get:7 http://deb.debian.org stable/main amd64 Packages [9049 kB]
Fetched 9933 kB in 3s (2760 kB/s)
Reading package lists…
Reading package lists…
Building dependency tree…
Reading state information…
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Reading package lists…
Building dependency tree…
Reading state information…
The following extra packages will be installed:
apache2-bin apache2-data apache2-utils elinks-data file krb5-locales
libalgorithm-c3-perl libapr1 libaprutil1 libaprutil1-dbd-sqlite3
libaprutil1-ldap libarchive-extract-perl libcgi-fast-perl libcgi-pm-perl
libclass-c3-perl libclass-c3-xs-perl libcpan-meta-perl libdata-optlist-perl
libdata-section-perl libexpat1 libfcgi-perl libffi6 libfsplib0 libgdbm3
libgmp10 libgnutls-deb0-28 libgpm2 libgssapi-krb5-2 libhogweed2 libidn11
libk5crypto3 libkeyutils1 libkrb5-3 libkrb5support0 libldap-2.4-2
liblog-message-perl liblog-message-simple-perl liblua5.1-0 libmagic1
libmodule-build-perl libmodule-pluggable-perl libmodule-signature-perl
libmro-compat-perl libnettle4 libp11-kit0 libpackage-constants-perl
libparams-util-perl libperl5.20 libpod-latex-perl libpod-readme-perl
libregexp-common-perl libsasl2-2 libsasl2-modules libsasl2-modules-db
libsoftware-license-perl libsqlite3-0 libssl1.0.0 libsub-exporter-perl
libsub-install-perl libtasn1-6 libterm-ui-perl libtext-soundex-perl
libtext-template-perl libtre5 libxml2 mime-support openssl perl perl-modules
rename sgml-base ssl-cert xml-core
Suggested packages:
www-browser apache2-doc apache2-suexec-pristine apache2-suexec-custom
elinks-doc gnutls-bin gpm krb5-doc krb5-user libsasl2-modules-otp
libsasl2-modules-ldap libsasl2-modules-sql libsasl2-modules-gssapi-mit
libsasl2-modules-gssapi-heimdal tre-agrep ca-certificates perl-doc
libterm-readline-gnu-perl libterm-readline-perl-perl make libb-lint-perl
libcpanplus-dist-build-perl libcpanplus-perl libfile-checktree-perl
libobject-accessor-perl sgml-base-doc openssl-blacklist debhelper
Recommended packages:
libarchive-tar-perl
The following NEW packages will be installed:
apache2 apache2-bin apache2-data apache2-utils elinks elinks-data file
krb5-locales libalgorithm-c3-perl libapr1 libaprutil1
libaprutil1-dbd-sqlite3 libaprutil1-ldap libarchive-extract-perl
libcgi-fast-perl libcgi-pm-perl libclass-c3-perl libclass-c3-xs-perl
libcpan-meta-perl libdata-optlist-perl libdata-section-perl libexpat1
libfcgi-perl libffi6 libfsplib0 libgdbm3 libgmp10 libgnutls-deb0-28 libgpm2
libgssapi-krb5-2 libhogweed2 libidn11 libk5crypto3 libkeyutils1 libkrb5-3
libkrb5support0 libldap-2.4-2 liblog-message-perl liblog-message-simple-perl
liblua5.1-0 libmagic1 libmodule-build-perl libmodule-pluggable-perl
libmodule-signature-perl libmro-compat-perl libnettle4 libp11-kit0
libpackage-constants-perl libparams-util-perl libperl5.20 libpod-latex-perl
libpod-readme-perl libregexp-common-perl libsasl2-2 libsasl2-modules
libsasl2-modules-db libsoftware-license-perl libsqlite3-0 libssl1.0.0
libsub-exporter-perl libsub-install-perl libtasn1-6 libterm-ui-perl
libtext-soundex-perl libtext-template-perl libtre5 libxml2 mime-support
openssl perl perl-modules rename sgml-base ssl-cert telnet xml-core
0 upgraded, 76 newly installed, 0 to remove and 0 not upgraded.
Setting up xml-core (0.13+nmu2) …
Processing triggers for libc-bin (2.19-18+deb8u7) …
Processing triggers for systemd (215-17+deb8u6) …
Processing triggers for sgml-base (1.26+nmu4) …
—> 93f2c10077ca
Removing intermediate container dac446cc4624
Step 4 : ENV MYVALUE 123
—> Running in 9f37b82671d0
—> 0fb33326a344
Removing intermediate container 9f37b82671d0
Step 5 : EXPOSE 80
—> Running in eb72bd402b07
—> 4e1e41963851
Removing intermediate container eb72bd402b07
Step 6 : EXPOSE 22
—> Running in 0ef5d0e744c3
—> e85ba127afdd
Removing intermediate container 0ef5d0e744c3
Successfully built e85ba127afdd

root@cloudshell:~$ docker run -it rafi494/apache /bin/bash

root@1794d915bf95:/# printenv MYVALUE
123

root@1794d915bf95:/# service apache2 status
[FAIL] apache2 is not running … failed!

root@cloudshell:~$ vim Dockerfile
FROM debian:stable
MAINTAINER rafi494 <mohammedrafi494@gmail.com>
RUN apt-get update -y && apt-get upgrade -y && apt-get install telnet elinks apache2 -y

ENV MYVALUE 123

EXPOSE 80
CMD [“/usr/sbin/apache2″,”-D”,”FOREGROUND”]

root@cloudshell:~$ docker build -t rafi494/apache .
Sending build context to Docker daemon 196 MB
Step 1 : FROM debian:stable
—> 58cf158c4bd6
Step 2 : MAINTAINER rafi494 <mohammedrafi494@gmail.com>
—> Using cache
—> 7d33712d7521
Step 3 : RUN apt-get update -y && apt-get upgrade -y && apt-get install telnet elinks apache2 -y
—> Using cache
—> 93f2c10077ca
Step 4 : ENV MYVALUE 123
—> Using cache
—> 0fb33326a344
Step 5 : EXPOSE 80
—> Using cache
—> 4e1e41963851
Step 6 : CMD /usr/sbin/apache2 -D FOREGROUND
—> Running in 2e538bdd68dd
—> 125aa6c7ead9
Removing intermediate container 2e538bdd68dd
Successfully built 125aa6c7ead9

root@cloudshell:~$ docker run -d rafi494/apache
a55056de1d269b06ab1f70cb87d4fa0497b6cad550c8bb64275a9d5f753c1855

root@cloudshell:~$ docker login
Login with your Docker ID to push and pull images from Docker Hub. If you don’t have a Docker ID, head over to https://hub.docker.com to create one.
Username: rafi494
Password:
Login Succeeded

root@cloudshell:~$ docker push rafi494/apache
The push refers to a repository [docker.io/rafi494/apache]
031d24e13a9c: Pushed
a6a6028552b3: Mounted from library/debian
latest: digest: sha256:627497b7170152099c0971de6529f8aeee070741747a425d872f5661cc1250a5 size: 741

dockerfile1dockerfile2
root@cloudshell:~$ docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
rafi494/apache latest db7e59debdad 17 minutes ago 145.7 MB
debian stable 58cf158c4bd6 9 days ago 123.4 MB

root@cloudshell:~$ docker run -it rafi494/apache /bin/bash
root@0b1a3ab6f2cb:/# cat /etc/os-release
PRETTY_NAME=”Debian GNU/Linux 8 (jessie)”
NAME=”Debian GNU/Linux”
VERSION_ID=”8″
VERSION=”8 (jessie)”
ID=debian
HOME_URL=”http://www.debian.org/&#8221;
SUPPORT_URL=”http://www.debian.org/support&#8221;
BUG_REPORT_URL=”https://bugs.debian.org/&#8221;
root@cloudshell:~$ docker inspect rafi494/apache
[
{
“Id”: “sha256:db7e59debdad4755b77065f08535ac6acb1c44c8c4d07f7d2ae11ccc2196f6e2”,
“RepoTags”: [
“rafi494/apache:latest”
],
“RepoDigests”: [],
“Parent”: “sha256:7d33712d7521c06117006b9e33a26cc49d3298ef80423e14a6c0b40b3d6cd812”,
“Comment”: “”,
“Created”: “2017-05-04T00:45:00.088887127Z”,
“Container”: “24a272a3b4c86a599f7011de7fda654be69166947b9a237b21b9dd9cb25ad83b”,
“ContainerConfig”: {
“Hostname”: “64cc9f2bcf39”,
“Domainname”: “”,
“User”: “”,
“AttachStdin”: false,
“AttachStdout”: false,
“AttachStderr”: false,
“Tty”: false,
“OpenStdin”: false,
“StdinOnce”: false,
“Env”: [
“PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin”
],
“Cmd”: [
“/bin/sh”,
“-c”,
“apt-get update -y \u0026\u0026 apt-get upgrade -y \u0026\u0026 apt-get install telnet elinks -y”
],
“ArgsEscaped”: true,
“Image”: “sha256:7d33712d7521c06117006b9e33a26cc49d3298ef80423e14a6c0b40b3d6cd812”,
“Volumes”: null,
“WorkingDir”: “”,
“Entrypoint”: null,
“OnBuild”: [],
“Labels”: {}
},
“DockerVersion”: “1.11.2”,
“Author”: “rafi494 \u003cmohammedrafi494@gmail.com\u003e”,
“Config”: {
“Hostname”: “64cc9f2bcf39”,
“Domainname”: “”,
“User”: “”,
“AttachStdin”: false,
“AttachStdout”: false,
“AttachStderr”: false,
“Tty”: false,
“OpenStdin”: false,
“StdinOnce”: false,
“Env”: [
“PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin”
],
“Cmd”: [
“/bin/bash”
],
“ArgsEscaped”: true,
“Image”: “sha256:7d33712d7521c06117006b9e33a26cc49d3298ef80423e14a6c0b40b3d6cd812”,
“Volumes”: null,
“WorkingDir”: “”,
“Entrypoint”: null,
“OnBuild”: [],
“Labels”: {}
},
“Architecture”: “amd64”,
“Os”: “linux”,
“Size”: 145653353,
“VirtualSize”: 145653353,
“GraphDriver”: {
“Name”: “aufs”,
“Data”: null
},
“RootFS”: {
“Type”: “layers”,
“Layers”: [
“sha256:a6a6028552b378b2002d8154ffc829b06b92fc7ca41c448aade0610359d939bd”,
“sha256:031d24e13a9cdaf3f8779010b607da9fadfbf320fb6c7d01301c843553aca8e7”
]
}
}
]

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s