Monthly Archives: December 2017

How to setup Ubuntu 16.x Virtual machine [VM] for Vmware on Windows

ubuntu-16-04-lts-810x623.png

For most of the lab practices you need Linux virtual machine.
Ubuntu is one of the famous OS under Linux flavors.
I have created a VM of Ubuntu 16.04 LTS on VMware.
This has GUI also. So you can also use web browser, etc.
You can use the same for your lab practice.

For Ubuntu cloud Virtual machine download these 9 files into a separate directory.

https://drive.google.com/open?id=11uEf9rPbH1a0EE-dfUMOK8qNvJxmYLQ_

And copy them into another  safe  directory.

Once you complete the above  I will guide you further.
Please note you need to have atleast 60GB space to practice.

Once you have copied them into a separate folder, Use the below link to setup Vmware Player for Windows:

Once the VMware player is opened, you can open the Virtual Machine from the above folder.
It shows one VMDK file. Just click on it.
You will be logging as:
user id:VSK  and
its Pwd is : kumar123
Now you can see like your linux ubuntu machine. with GUI.
You can start playing with your linux commands and start browsing web also.
If you are done with the above test run, then we can start your real labs session with Linux OS.
For docker labs, start following the below link and its series:

Some useful docker Commands for handling images and containers

Docker-logo

With reference to the past lab sessions let us recap the below docker commands for reference.

Commands for images and containers handling:

1. How to list docker images:

$ sudo docker images

2. How to check the images status:

$ sudo docker ps -a

3. How to tag a docker image:

$ sudo docker tag <image id> < image name >

Ex: sudo docker tag 8de083612fef ubuntu-testbox1

4. How to list the container ids:

$ sudo docker pa -aq

5. How to remove all containers:

$ sudo docker containers prune

It removes all the containers on the current docker host machine

6. How to remove a docker image:

$sudo docker rmi image <image id>

Example:

sudo docker rmi image 6ad733544a63

7. How to run a dockerfile from the current directory:

$ sudo docker build -t ubuntu-vmbox .

Note: You need to make sure there is a dockerfile in the pwd.

8. How to run a container as interactive in a terminal mode:

$ sudo docker run -i -t ubuntu-vmbox /bin/bash

Note: Ubuntu-vmcbox is your image repository name.

9. How to see a history of a docker image:

$ sudo docker history hello-world

Note: hello-world is a docker image.

10. How to see the docker information:

$ sudo docker info

11. How to check the docker services status:

$ sudo service docker status

12. How to start a container :

$ sudo docker start  d10ad2bd62f7

13. How to stop a container :

$ sudo docker stop d10ad2bd62f7

14. How to attach  a container  into interactive terminal mode:
$ sudo docker attach d10ad2bd62f7

Note: The container comes into terminal interactive mode.

15. How to pause a container:
$ sudo docker pause 155f4b0764b1

16. How to unpause a container:
$ sudo docker unpause 155f4b0764b1

17. How to remove a single container:

$ sudo docker rm <container id>

Example: sudo docker rm 1dd55efde43f

Note: You can use prune command to remove all the containers as mentioned in the above questions.

 

12. DevOps: How to build docker images using dockerfile ? -1

 

Docker-logo

In continuation of my  previous session on :”11. DevOps: How to Launch a container as a daemon ?”, in this session I would like to demonstrate the exercises on:

“How to build docker images using dockerfile ?:”

These images are basic operating environments, such as ubuntu.
We found these while doing the other lab exercises.
The docker images can craft advanced application stacks for the enterprise and cloud IT environments.
Currently let us craft an image manually by launching a container from a base image.
A best practices is, we can build an automated approach of crafting the images using Dockerfile.
The dockerfile is a a text-based build script which contains special instructions in a sequence for building the correct and the relevant images from the base images.

Please note; we will explore all these combinations in different sessions.

Now, let us understand this automated approach from the below steps:
1. The sequential instructions inside Dockerfile can include selecting the base image as 1st statement.
2. And in the later statements; installing the required application, adding the configuration and the data files, and automatically running the services as well as exposing those services to the external world.

This way the dockerfile based automated build approach has simplified the image building process.

It also offers a great deal of flexibility in organizing the build instructions and in visualizing the complete build process, while running the script instructions.

The Docker Engine tightly integrates this build process with the help of the docker ‘build’ subcommand.

This process involes the below steps:
1. Let us imagine; in the client server scenario of Docker, the Docker server (or daemon) is responsible towards complete build process.
2. And the Docker command-line interface is responsible for transferring the build context, including transferring Dockerfile to the daemon.
Now, let us list our existing images as below, in continuation of previous exercise:
=============>
vskumar@ubuntu:~$
vskumar@ubuntu:~$ sudo docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
docker-exercise/ubuntu-wgetinstall latest e34304119838 7 days ago 169MB
<none> <none> fc7e4564eb92 7 days ago 169MB
hello-world latest f2a91732366c 12 days ago 1.85kB
ubuntu 16.04 20c44cd7596f 2 weeks ago 123MB
ubuntu latest 20c44cd7596f 2 weeks ago 123MB
busybox latest 6ad733544a63 4 weeks ago 1.13MB
busybox 1.24 47bcc53f74dc 20 months ago 1.11MB
vskumar@ubuntu:~$
====================>
Now,  let us create a simple container from the ubuntu base image.
To create it, we can create ‘dockerfile’ without extension using vi in the current pwd.

Please note we do not have vim utility in this Ubuntu base image.
=================>
vskumar@ubuntu:~$ pwd
/home/vskumar
vskumar@ubuntu:~$ vi dockerfile
============>
Now, let us cat the dockerfile as below:
=============>
vskumar@ubuntu:~$ ls -l
total 48
drwxr-xr-x 3 vskumar vskumar 4096 Nov 24 23:32 Desktop
-rw-rw-r– 1 vskumar vskumar 86 Dec 3 04:29 dockerfile
drwxr-xr-x 2 vskumar vskumar 4096 Nov 22 21:23 Documents
drwxr-xr-x 2 vskumar vskumar 4096 Nov 25 06:33 Downloads
-rw-r–r– 1 vskumar vskumar 8980 Nov 22 21:03 examples.desktop
drwxr-xr-x 2 vskumar vskumar 4096 Nov 22 21:23 Music
drwxr-xr-x 2 vskumar vskumar 4096 Nov 25 06:02 Pictures
drwxr-xr-x 2 vskumar vskumar 4096 Nov 22 21:23 Public
drwxr-xr-x 2 vskumar vskumar 4096 Nov 22 21:23 Templates
drwxr-xr-x 2 vskumar vskumar 4096 Nov 22 21:23 Videos
vskumar@ubuntu:~$
vskumar@ubuntu:~$ cat dockerfile
FROM ubuntu
CMD [“echo”, “This is done by vskumar for a lab practice of dockerfile”]
vskumar@ubuntu:~$
================>
From the above dockerfile contents:
1st line FROM ubuntu – denotes it is using the buntu as the base image to create the container.
2nd line: CMD [“echo”, “This is done by vskumar for a lab practice of dockerfile”]
denotes using CMD echo command is executed to print the message “This is done by vskumar for a lab practice of dockerfile”.
Now let us run this file through the below command:
$ sudo docker build .
We can see the output as below:
===============>
vskumar@ubuntu:~$ sudo docker build .
Sending build context to Docker daemon 112MB
Step 1/2 : FROM ubuntu
—> 20c44cd7596f
Step 2/2 : CMD [“echo”, “This is done by vskumar for a lab practice of dockerfile”]
—> Running in 1de59a4799fa
Removing intermediate container 1de59a4799fa
—> 8de083612fef
Successfully built 8de083612fef
vskumar@ubuntu:~$
===================>
Now, let us list the images:
==================>
vskumar@ubuntu:~$
vskumar@ubuntu:~$ sudo docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
<none> <none> 8de083612fef About a minute ago 123MB
docker-exercise/ubuntu-wgetinstall latest e34304119838 7 days ago 169MB
<none> <none> fc7e4564eb92 7 days ago 169MB
hello-world latest f2a91732366c 12 days ago 1.85kB
ubuntu 16.04 20c44cd7596f 2 weeks ago 123MB
ubuntu latest 20c44cd7596f 2 weeks ago 123MB
busybox latest 6ad733544a63 4 weeks ago 1.13MB
busybox 1.24 47bcc53f74dc 20 months ago 1.11MB
vskumar@ubuntu:~$
==========================>
We can see Imgae id: 8de083612fef is created just now.
Look into that line there is no tag given.
Now let us tag it as below:
$ sudo docker tag 8de083612fef ubuntu-testbox1
================>
vskumar@ubuntu:~$
vskumar@ubuntu:~$ sudo docker tag 8de083612fef ubuntu-testbox1
vskumar@ubuntu:~$ sudo docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
ubuntu-testbox1 latest 8de083612fef 4 minutes ago 123MB
docker-exercise/ubuntu-wgetinstall latest e34304119838 7 days ago 169MB
<none> <none> fc7e4564eb92 7 days ago 169MB
hello-world latest f2a91732366c 12 days ago 1.85kB
ubuntu 16.04 20c44cd7596f 2 weeks ago 123MB
ubuntu latest 20c44cd7596f 2 weeks ago 123MB
busybox latest 6ad733544a63 4 weeks ago 1.13MB
busybox 1.24 47bcc53f74dc 20 months ago 1.11MB
vskumar@ubuntu:~$
====================>
Now, let us do some housekeeping on these containers.
Let us list the containers using ps -a command
====================>
vskumar@ubuntu:~$ sudo docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
0fe495fc93ed ubuntu “/bin/bash -c ‘while…” 8 hours ago Exited (137) 4 hours ago hungry_engelbart
10ffea6140f9 ubuntu “bash” 7 days ago Exited (0) 7 days ago quizzical_lalande
b2a79f8d2fe6 ubuntu “/bin/bash -c ‘while…” 7 days ago Exited (255) 7 days ago goofy_borg
155f4b0764b1 ubuntu:16.04 “/bin/bash” 7 days ago Exited (0) 7 days ago zen_volhard
vskumar@ubuntu:~$
=====================>
I want to remove all of them. We can recreate with the dockerfile as an exercise.
$ Sudo docker containers prune
=======================================>
vskumar@ubuntu:~$ sudo docker ps -aq
0fe495fc93ed
10ffea6140f9
b2a79f8d2fe6
155f4b0764b1
vskumar@ubuntu:~$ sudo docker container prune
WARNING! This will remove all stopped containers.
Are you sure you want to continue? [y/N] y
Deleted Containers:
0fe495fc93edee3aaadc7fc0fbf21997f0ca3cde4d7e563aa8c61352a43957dd
10ffea6140f9c93b37bad2f9d159ad53aa121c0de69a9d145f07cc12f9591324
b2a79f8d2fe65453fce19f00d7adf03ed6dcced69ae68fba94ad0c416545263e
155f4b0764b16f1c8776a101cced6ea95c55eeabe69aeab8520cbe925bedc456

Total reclaimed space: 186B
vskumar@ubuntu:~$ sudo docker ps -aq
vskumar@ubuntu:~$
============== so now there are no containers =========>
Let us build the container.
Before building let us check the available images:
==================>
vskumar@ubuntu:~$ sudo docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
ubuntu-testbox1 latest 8de083612fef 24 minutes ago 123MB
docker-exercise/ubuntu-wgetinstall latest e34304119838 7 days ago 169MB
<none> <none> fc7e4564eb92 7 days ago 169MB
hello-world latest f2a91732366c 12 days ago 1.85kB
ubuntu 16.04 20c44cd7596f 2 weeks ago 123MB
ubuntu latest 20c44cd7596f 2 weeks ago 123MB
busybox latest 6ad733544a63 4 weeks ago 1.13MB
busybox 1.24 47bcc53f74dc 20 months ago 1.11MB
vskumar@ubuntu:~$
====================>
Let us remove some more images also.
We need to use the below commands:
=========== Let us try one image removal =========>
vskumar@ubuntu:~$ sudo docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
ubuntu-testbox1 latest 8de083612fef 33 minutes ago 123MB
docker-exercise/ubuntu-wgetinstall latest e34304119838 7 days ago 169MB
<none> <none> fc7e4564eb92 7 days ago 169MB
hello-world latest f2a91732366c 12 days ago 1.85kB
ubuntu 16.04 20c44cd7596f 2 weeks ago 123MB
ubuntu latest 20c44cd7596f 2 weeks ago 123MB
busybox latest 6ad733544a63 4 weeks ago 1.13MB
busybox 1.24 47bcc53f74dc 20 months ago 1.11MB
vskumar@ubuntu:~$ sudo docker rmi image 47bcc53f74dc
Untagged: busybox:1.24
Untagged: busybox@sha256:8ea3273d79b47a8b6d018be398c17590a4b5ec604515f416c5b797db9dde3ad8
Deleted: sha256:47bcc53f74dc94b1920f0b34f6036096526296767650f223433fe65c35f149eb
Deleted: sha256:f6075681a244e9df4ab126bce921292673c9f37f71b20f6be1dd3bb99b4fdd72
Deleted: sha256:1834950e52ce4d5a88a1bbd131c537f4d0e56d10ff0dd69e66be3b7dfa9df7e6
Error: No such image: image
vskumar@ubuntu:~$
=================================>
So, by using :
sudo docker rmi image [image id], we can remove the image.

Now, further continuation of our dockerfile exercise;
We can create a container from ubuntu base image and install vim package on it with the help of dockerfile.
To do this we need to have following dockerfile script.
——————>
FROM ubuntu
RUN apt-get update
RUN apt-get -y install vim
CMD [“echo”, “This is done by vskumar for a lab demo on dockerfile”]
—————–>
Before doing it, let me do some housekeeping.
I have removed the below image:
==================>
vskumar@ubuntu:~$
vskumar@ubuntu:~$ sudo docker rmi image 6ad733544a63
Untagged: busybox:latest
Untagged: busybox@sha256:bbc3a03235220b170ba48a157dd097dd1379299370e1ed99ce976df0355d24f0
Deleted: sha256:6ad733544a6317992a6fac4eb19fe1df577d4dec7529efec28a5bd0edad0fd30
Deleted: sha256:0271b8eebde3fa9a6126b1f2335e170f902731ab4942f9f1914e77016540c7bb
Error: No such image: image
=====================>
See the current status:
===================>
vskumar@ubuntu:~$ ls
Desktop dockerfile Documents Downloads examples.desktop Music Pictures Public Templates Videos
vskumar@ubuntu:~$ sudo docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
ubuntu-testbox1 latest 8de083612fef About an hour ago 123MB
docker-exercise/ubuntu-wgetinstall latest e34304119838 7 days ago 169MB
<none> <none> fc7e4564eb92 7 days ago 169MB
hello-world latest f2a91732366c 12 days ago 1.85kB
ubuntu 16.04 20c44cd7596f 2 weeks ago 123MB
vskumar@ubuntu:~$
======================>
Now let me update the dockerfile through vi and cat that file:
====================>
vskumar@ubuntu:~$
vskumar@ubuntu:~$ pwd
/home/vskumar
vskumar@ubuntu:~$ vi dockerfile
vskumar@ubuntu:~$ cat dockerfile
FROM ubuntu
RUN apt-get update
RUN apt-get -y install vim
CMD [“echo”, “This is done by vskumar for a lab practice of dockerfile”]
vskumar@ubuntu:~$
====================>
Now let me run the below command:
$ sudo docker build -t ubuntu-vmbox .
This time; I have added the tag name as ‘ ubuntu-vmbox’.
We need to understand; there are below tasks it involves:
1. Updating the ubuntu libraries – it takes some time by displaying lot of output.
2. Installing vim utility. — This also takes some time.
3. Displaying the message.
We can see this large size output:
=========== Update the packages and install the vim in a conatiner ==========>
vskumar@ubuntu:~$ pwd
/home/vskumar
vskumar@ubuntu:~$ sudo docker build -t ubuntu-vmbox .
Sending build context to Docker daemon 112MB
Step 1/4 : FROM ubuntu
latest: Pulling from library/ubuntu
Digest: sha256:7c67a2206d3c04703e5c23518707bdd4916c057562dd51c74b99b2ba26af0f79
Status: Downloaded newer image for ubuntu:latest
—> 20c44cd7596f
Step 2/4 : RUN apt-get update
—> Running in df81eaef9437
Get:1 http://archive.ubuntu.com/ubuntu xenial InRelease [247 kB]
Get:2 http://security.ubuntu.com/ubuntu xenial-security InRelease [102 kB]
Get:3 http://archive.ubuntu.com/ubuntu xenial-updates InRelease [102 kB]
Get:4 http://archive.ubuntu.com/ubuntu xenial-backports InRelease [102 kB]
Get:5 http://archive.ubuntu.com/ubuntu xenial/universe Sources [9802 kB]
Get:6 http://security.ubuntu.com/ubuntu xenial-security/universe Sources [53.1 kB]
Get:7 http://archive.ubuntu.com/ubuntu xenial/main amd64 Packages [1558 kB]
Get:8 http://archive.ubuntu.com/ubuntu xenial/restricted amd64 Packages [14.1 kB]
Get:9 http://archive.ubuntu.com/ubuntu xenial/universe amd64 Packages [9827 kB]
Get:10 http://archive.ubuntu.com/ubuntu xenial/multiverse amd64 Packages [176 kB]
Get:11 http://archive.ubuntu.com/ubuntu xenial-updates/universe Sources [231 kB]
Get:12 http://archive.ubuntu.com/ubuntu xenial-updates/main amd64 Packages [866 kB]
Get:13 http://archive.ubuntu.com/ubuntu xenial-updates/restricted amd64 Packages [13.7 kB]
Get:14 http://archive.ubuntu.com/ubuntu xenial-updates/universe amd64 Packages [719 kB]
Get:15 http://archive.ubuntu.com/ubuntu xenial-updates/multiverse amd64 Packages [18.5 kB]
Get:16 http://archive.ubuntu.com/ubuntu xenial-backports/main amd64 Packages [5174 B]
Get:17 http://archive.ubuntu.com/ubuntu xenial-backports/universe amd64 Packages [7150 B]
Get:18 http://security.ubuntu.com/ubuntu xenial-security/main amd64 Packages [505 kB]
Get:19 http://security.ubuntu.com/ubuntu xenial-security/restricted amd64 Packages [12.9 kB]
Get:20 http://security.ubuntu.com/ubuntu xenial-security/universe amd64 Packages [229 kB]
Get:21 http://security.ubuntu.com/ubuntu xenial-security/multiverse amd64 Packages [3479 B]
Fetched 24.6 MB in 2min 5s (196 kB/s)
Reading package lists…
Removing intermediate container df81eaef9437
—> 13cd766374bc
Step 3/4 : RUN apt-get -y install vim
—> Running in d37783a8cb7d
Reading package lists…
Building dependency tree…
Reading state information…
The following additional packages will be installed:
file libexpat1 libgpm2 libmagic1 libmpdec2 libpython3.5 libpython3.5-minimal
libpython3.5-stdlib libsqlite3-0 libssl1.0.0 mime-support vim-common
vim-runtime
Suggested packages:
gpm ctags vim-doc vim-scripts vim-gnome-py2 | vim-gtk-py2 | vim-gtk3-py2
| vim-athena-py2 | vim-nox-py2
The following NEW packages will be installed:
file libexpat1 libgpm2 libmagic1 libmpdec2 libpython3.5 libpython3.5-minimal
libpython3.5-stdlib libsqlite3-0 libssl1.0.0 mime-support vim vim-common
vim-runtime
0 upgraded, 14 newly installed, 0 to remove and 2 not upgraded.
Need to get 12.2 MB of archives.
After this operation, 58.3 MB of additional disk space will be used.
Get:1 http://archive.ubuntu.com/ubuntu xenial/main amd64 libgpm2 amd64 1.20.4-6.1 [16.5 kB]
Get:2 http://archive.ubuntu.com/ubuntu xenial/main amd64 libmagic1 amd64 1:5.25-2ubuntu1 [216 kB]
Get:3 http://archive.ubuntu.com/ubuntu xenial/main amd64 file amd64 1:5.25-2ubuntu1 [21.2 kB]
Get:4 http://archive.ubuntu.com/ubuntu xenial-updates/main amd64 libexpat1 amd64 2.1.0-7ubuntu0.16.04.3 [71.2 kB]
Get:5 http://archive.ubuntu.com/ubuntu xenial/main amd64 libmpdec2 amd64 2.4.2-1 [82.6 kB]
Get:6 http://archive.ubuntu.com/ubuntu xenial-updates/main amd64 libssl1.0.0 amd64 1.0.2g-1ubuntu4.9 [1085 kB]
Get:7 http://archive.ubuntu.com/ubuntu xenial-updates/main amd64 libpython3.5-minimal amd64 3.5.2-2ubuntu0~16.04.4 [523 kB]
Get:8 http://archive.ubuntu.com/ubuntu xenial/main amd64 mime-support all 3.59ubuntu1 [31.0 kB]
Get:9 http://archive.ubuntu.com/ubuntu xenial/main amd64 libsqlite3-0 amd64 3.11.0-1ubuntu1 [396 kB]
Get:10 http://archive.ubuntu.com/ubuntu xenial-updates/main amd64 libpython3.5-stdlib amd64 3.5.2-2ubuntu0~16.04.4 [2132 kB]
Get:11 http://archive.ubuntu.com/ubuntu xenial-updates/main amd64 vim-common amd64 2:7.4.1689-3ubuntu1.2 [103 kB]
Get:12 http://archive.ubuntu.com/ubuntu xenial-updates/main amd64 libpython3.5 amd64 3.5.2-2ubuntu0~16.04.4 [1360 kB]
Get:13 http://archive.ubuntu.com/ubuntu xenial-updates/main amd64 vim-runtime all 2:7.4.1689-3ubuntu1.2 [5164 kB]
Get:14 http://archive.ubuntu.com/ubuntu xenial-updates/main amd64 vim amd64 2:7.4.1689-3ubuntu1.2 [1036 kB]
debconf: delaying package configuration, since apt-utils is not installed
Fetched 12.2 MB in 12s (949 kB/s)
Selecting previously unselected package libgpm2:amd64.
(Reading database … 4768 files and directories currently installed.)
Preparing to unpack …/libgpm2_1.20.4-6.1_amd64.deb …
Unpacking libgpm2:amd64 (1.20.4-6.1) …
Selecting previously unselected package libmagic1:amd64.
Preparing to unpack …/libmagic1_1%3a5.25-2ubuntu1_amd64.deb …
Unpacking libmagic1:amd64 (1:5.25-2ubuntu1) …
Selecting previously unselected package file.
Preparing to unpack …/file_1%3a5.25-2ubuntu1_amd64.deb …
Unpacking file (1:5.25-2ubuntu1) …
Selecting previously unselected package libexpat1:amd64.
Preparing to unpack …/libexpat1_2.1.0-7ubuntu0.16.04.3_amd64.deb …
Unpacking libexpat1:amd64 (2.1.0-7ubuntu0.16.04.3) …
Selecting previously unselected package libmpdec2:amd64.
Preparing to unpack …/libmpdec2_2.4.2-1_amd64.deb …
Unpacking libmpdec2:amd64 (2.4.2-1) …
Selecting previously unselected package libssl1.0.0:amd64.
Preparing to unpack …/libssl1.0.0_1.0.2g-1ubuntu4.9_amd64.deb …
Unpacking libssl1.0.0:amd64 (1.0.2g-1ubuntu4.9) …
Selecting previously unselected package libpython3.5-minimal:amd64.
Preparing to unpack …/libpython3.5-minimal_3.5.2-2ubuntu0~16.04.4_amd64.deb …
Unpacking libpython3.5-minimal:amd64 (3.5.2-2ubuntu0~16.04.4) …
Selecting previously unselected package mime-support.
Preparing to unpack …/mime-support_3.59ubuntu1_all.deb …
Unpacking mime-support (3.59ubuntu1) …
Selecting previously unselected package libsqlite3-0:amd64.
Preparing to unpack …/libsqlite3-0_3.11.0-1ubuntu1_amd64.deb …
Unpacking libsqlite3-0:amd64 (3.11.0-1ubuntu1) …
Selecting previously unselected package libpython3.5-stdlib:amd64.
Preparing to unpack …/libpython3.5-stdlib_3.5.2-2ubuntu0~16.04.4_amd64.deb …
Unpacking libpython3.5-stdlib:amd64 (3.5.2-2ubuntu0~16.04.4) …
Selecting previously unselected package vim-common.
Preparing to unpack …/vim-common_2%3a7.4.1689-3ubuntu1.2_amd64.deb …
Unpacking vim-common (2:7.4.1689-3ubuntu1.2) …
Selecting previously unselected package libpython3.5:amd64.
Preparing to unpack …/libpython3.5_3.5.2-2ubuntu0~16.04.4_amd64.deb …
Unpacking libpython3.5:amd64 (3.5.2-2ubuntu0~16.04.4) …
Selecting previously unselected package vim-runtime.
Preparing to unpack …/vim-runtime_2%3a7.4.1689-3ubuntu1.2_all.deb …
Adding ‘diversion of /usr/share/vim/vim74/doc/help.txt to /usr/share/vim/vim74/doc/help.txt.vim-tiny by vim-runtime’
Adding ‘diversion of /usr/share/vim/vim74/doc/tags to /usr/share/vim/vim74/doc/tags.vim-tiny by vim-runtime’
Unpacking vim-runtime (2:7.4.1689-3ubuntu1.2) …
Selecting previously unselected package vim.
Preparing to unpack …/vim_2%3a7.4.1689-3ubuntu1.2_amd64.deb …
Unpacking vim (2:7.4.1689-3ubuntu1.2) …
Processing triggers for libc-bin (2.23-0ubuntu9) …
Setting up libgpm2:amd64 (1.20.4-6.1) …
Setting up libmagic1:amd64 (1:5.25-2ubuntu1) …
Setting up file (1:5.25-2ubuntu1) …
Setting up libexpat1:amd64 (2.1.0-7ubuntu0.16.04.3) …
Setting up libmpdec2:amd64 (2.4.2-1) …
Setting up libssl1.0.0:amd64 (1.0.2g-1ubuntu4.9) …
debconf: unable to initialize frontend: Dialog
debconf: (TERM is not set, so the dialog frontend is not usable.)
debconf: falling back to frontend: Readline
debconf: unable to initialize frontend: Readline
debconf: (Can’t locate Term/ReadLine.pm in @INC (you may need to install the Term::ReadLine module) (@INC contains: /etc/perl /usr/local/lib/x86_64-linux-gnu/perl/5.22.1 /usr/local/share/perl/5.22.1 /usr/lib/x86_64-linux-gnu/perl5/5.22 /usr/share/perl5 /usr/lib/x86_64-linux-gnu/perl/5.22 /usr/share/perl/5.22 /usr/local/lib/site_perl /usr/lib/x86_64-linux-gnu/perl-base .) at /usr/share/perl5/Debconf/FrontEnd/Readline.pm line 7.)
debconf: falling back to frontend: Teletype
Setting up libpython3.5-minimal:amd64 (3.5.2-2ubuntu0~16.04.4) …
Setting up mime-support (3.59ubuntu1) …
Setting up libsqlite3-0:amd64 (3.11.0-1ubuntu1) …
Setting up libpython3.5-stdlib:amd64 (3.5.2-2ubuntu0~16.04.4) …
Setting up vim-common (2:7.4.1689-3ubuntu1.2) …
Setting up libpython3.5:amd64 (3.5.2-2ubuntu0~16.04.4) …
Setting up vim-runtime (2:7.4.1689-3ubuntu1.2) …
Setting up vim (2:7.4.1689-3ubuntu1.2) …
update-alternatives: using /usr/bin/vim.basic to provide /usr/bin/vim (vim) in auto mode
update-alternatives: using /usr/bin/vim.basic to provide /usr/bin/vimdiff (vimdiff) in auto mode
update-alternatives: using /usr/bin/vim.basic to provide /usr/bin/rvim (rvim) in auto mode
update-alternatives: using /usr/bin/vim.basic to provide /usr/bin/rview (rview) in auto mode
update-alternatives: using /usr/bin/vim.basic to provide /usr/bin/vi (vi) in auto mode
update-alternatives: using /usr/bin/vim.basic to provide /usr/bin/view (view) in auto mode
update-alternatives: using /usr/bin/vim.basic to provide /usr/bin/ex (ex) in auto mode
update-alternatives: using /usr/bin/vim.basic to provide /usr/bin/editor (editor) in auto mode
Processing triggers for libc-bin (2.23-0ubuntu9) …
Removing intermediate container d37783a8cb7d
—> c07c6f2d2c65
Step 4/4 : CMD [“echo”, “This is done by vskumar for a lab practice of dockerfile”]
—> Running in f7e85f87b578
Removing intermediate container f7e85f87b578
—> f6675f4738b7
Successfully built f6675f4738b7
Successfully tagged ubuntu-vmbox:latest
vskumar@ubuntu:~$
=== Finally you can see the ‘ubuntu-vmbox’ tagged conatiner ======>
We can see the latest image from the below images:
===== Current images list =====>
vskumar@ubuntu:~$ sudo docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
ubuntu-vmbox latest f6675f4738b7 3 minutes ago 220MB
ubuntu-testbox1 latest 8de083612fef About an hour ago 123MB
docker-exercise/ubuntu-wgetinstall latest e34304119838 7 days ago 169MB
<none> <none> fc7e4564eb92 7 days ago 169MB
hello-world latest f2a91732366c 12 days ago 1.85kB
ubuntu 16.04 20c44cd7596f 2 weeks ago 123MB
ubuntu latest 20c44cd7596f 2 weeks ago 123MB
vskumar@ubuntu:~$
=======================>
Now, I want to work with this newly created container. Please recollect my blog “https://vskumar.blog/2017/11/29/6-devops-how-to-work-with-interactive-docker-containers/”.
As we did practice in it; we can use the below command to work with this new container:

sudo docker run -i -t ubuntu-vmbox /bin/bash
I want to test the vim is working on it. See the below output:
==================>
vskumar@ubuntu:~$ sudo docker run -i -t ubuntu-vmbox /bin/bash

root@1169bb1285cf:/#
root@1169bb1285cf:/# pwd
/
root@1169bb1285cf:/# ls
bin boot dev etc home lib lib64 media mnt opt proc root run sbin srv sys tmp usr var
root@1169bb1285cf:/# vim test1
===== I have created the file with vim successfully ====>
Now let me use cat command and see its output:

================>
root@1169bb1285cf:/#
root@1169bb1285cf:/# ls
bin boot dev etc home lib lib64 media mnt opt proc root run sbin srv sys test1 tmp usr var
root@1169bb1285cf:/# cat test1
testing this vim box……
root@1169bb1285cf:/#
=================>

So, in this exercise we have updated the ubuntu libraries and installed vim utility.
And tested the container for vim usage by using interactive mode.

=========== Now let me exit and check the list of images =====>
root@1169bb1285cf:/#
root@1169bb1285cf:/# exit
exit
vskumar@ubuntu:~$ sudo docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
ubuntu-vmbox latest f6675f4738b7 13 minutes ago 220MB
ubuntu-testbox1 latest 8de083612fef About an hour ago 123MB
docker-exercise/ubuntu-wgetinstall latest e34304119838 7 days ago 169MB
<none> <none> fc7e4564eb92 7 days ago 169MB
hello-world latest f2a91732366c 12 days ago 1.85kB
ubuntu 16.04 20c44cd7596f 2 weeks ago 123MB
ubuntu latest 20c44cd7596f 2 weeks ago 123MB
vskumar@ubuntu:~$
=============================>
So, the new container ‘ubuntu-vmbox’ is existing.

Now, I want to remove some images:
sudo docker rmi 20c44cd7596f
================>
vskumar@ubuntu:~$ sudo docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
ubuntu-vmbox latest f6675f4738b7 18 minutes ago 220MB
ubuntu-testbox1 latest 8de083612fef About an hour ago 123MB
docker-exercise/ubuntu-wgetinstall latest e34304119838 7 days ago 169MB
<none> <none> fc7e4564eb92 7 days ago 169MB
hello-world latest f2a91732366c 12 days ago 1.85kB
ubuntu 16.04 20c44cd7596f 2 weeks ago 123MB
ubuntu latest 20c44cd7596f 2 weeks ago 123MB
vskumar@ubuntu:~$ sudo docker rmi 20c44cd7596f
Error response from daemon: conflict: unable to delete 20c44cd7596f (cannot be forced) – image has dependent child images
vskumar@ubuntu:~$
== Please note the last image was the base to build the top tow containers ===>
Hence it has the child and parent relationship.
First we need to remove the child images and later the parent need to be removed.
=== You can see the removal of child one and one more image=====>
vskumar@ubuntu:~$ sudo docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
ubuntu-vmbox latest f6675f4738b7 20 minutes ago 220MB
ubuntu-testbox1 latest 8de083612fef 2 hours ago 123MB
docker-exercise/ubuntu-wgetinstall latest e34304119838 7 days ago 169MB
<none> <none> fc7e4564eb92 7 days ago 169MB
hello-world latest f2a91732366c 12 days ago 1.85kB
ubuntu 16.04 20c44cd7596f 2 weeks ago 123MB
ubuntu latest 20c44cd7596f 2 weeks ago 123MB
vskumar@ubuntu:~$ sudo docker rmi 8de083612fef
Untagged: ubuntu-testbox1:latest
Deleted: sha256:8de083612fefbf9723913748f7db4aba4154b17adc500d011f44df356736f06c
vskumar@ubuntu:~$ sudo docker rmi e34304119838
Untagged: docker-exercise/ubuntu-wgetinstall:latest
Deleted: sha256:e34304119838d79da60e12776529106c350b1972cd517648e8ab90311fad7b1a
vskumar@ubuntu:~$ sudo docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
ubuntu-vmbox latest f6675f4738b7 21 minutes ago 220MB
<none> <none> fc7e4564eb92 7 days ago 169MB
hello-world latest f2a91732366c 12 days ago 1.85kB
ubuntu 16.04 20c44cd7596f 2 weeks ago 123MB
ubuntu latest 20c44cd7596f 2 weeks ago 123MB
vskumar@ubuntu:~$
=================>
Let me do some more exercises on housekeeping.
I would like to present some more dependency issues for the above images. You can clearly see the output:
========= Dependencies =======>
vskumar@ubuntu:~$ sudo docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
ubuntu-vmbox latest f6675f4738b7 22 minutes ago 220MB
<none> <none> fc7e4564eb92 7 days ago 169MB
hello-world latest f2a91732366c 12 days ago 1.85kB
ubuntu 16.04 20c44cd7596f 2 weeks ago 123MB
ubuntu latest 20c44cd7596f 2 weeks ago 123MB
vskumar@ubuntu:~$ sudo docker rmi fc7e4564eb92
Deleted: sha256:fc7e4564eb928ccfe068c789f0d650967e8d5dc42d4e8d92409aab6614364075
Deleted: sha256:b16d78406b12e6dbc174f4e71bedb7b9edc0593cad10458ddf042738694c06db
vskumar@ubuntu:~$ sudo docker rmi 20c44cd7596f
Error response from daemon: conflict: unable to delete 20c44cd7596f (cannot be forced) – image has dependent child images
vskumar@ubuntu:~$ sudo docker rmi f6675f4738b7
Error response from daemon: conflict: unable to delete f6675f4738b7 (must be forced) – image is being used by stopped container 1169bb1285cf
vskumar@ubuntu:~$ sudo docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
1169bb1285cf ubuntu-vmbox “/bin/bash” 15 minutes ago Exited (0) 11 minutes ago heuristic_mayer
vskumar@ubuntu:~$
====================>
It means the container “1169bb1285cf ubuntu-vmbox” is the child to image id:f6675f4738b7.
===========>
vskumar@ubuntu:~$ sudo docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
ubuntu-vmbox latest f6675f4738b7 27 minutes ago 220MB
hello-world latest f2a91732366c 12 days ago 1.85kB
ubuntu 16.04 20c44cd7596f 2 weeks ago 123MB
ubuntu latest 20c44cd7596f 2 weeks ago 123MB
vskumar@ubuntu:~$ sudo docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
1169bb1285cf ubuntu-vmbox “/bin/bash” 19 minutes ago Exited (0) 14 minutes ago heuristic_mayer
vskumar@ubuntu:~$
==============>
So if I want to remove Image id: f6675f4738b7, I need to remove the container id:1169bb1285cf , and later I need to remove this image.
$ sudo docker rm container 1169bb1285cf
And later image removal command need to be used as below.
======================>
vskumar@ubuntu:~$ sudo docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
ubuntu-vmbox latest f6675f4738b7 31 minutes ago 220MB
hello-world latest f2a91732366c 12 days ago 1.85kB
ubuntu 16.04 20c44cd7596f 2 weeks ago 123MB
ubuntu latest 20c44cd7596f 2 weeks ago 123MB
vskumar@ubuntu:~$ sudo docker rmi f6675f4738b7
Untagged: ubuntu-vmbox:latest
Deleted: sha256:f6675f4738b721780721f345906a0c78c13a67ee8239a16f071504b217f41658
Deleted: sha256:c07c6f2d2c651dd406977d42d5504c941d7f975a84c8547abaf3869b50942820
Deleted: sha256:4855cfb7ae6f84279bbbfe87e7691377531a541785c613014f64909e6e0f4528
Deleted: sha256:13cd766374bcb31cc0e8cac971e82754bb8e1bc66780abaff264f847e00a94b2
Deleted: sha256:dc6fab8a33a18a8c840e19612253657c4610ab865a26de5a31260f71bcef5f76
vskumar@ubuntu:~$
========================>
So we have the below images only now:
==== Current images ======>
vskumar@ubuntu:~$ sudo docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
hello-world latest f2a91732366c 12 days ago 1.85kB
ubuntu 16.04 20c44cd7596f 2 weeks ago 123MB
ubuntu latest 20c44cd7596f 2 weeks ago 123MB
vskumar@ubuntu:~$
==========================>
We can try to remove the above images:
========= See it is declined due to it is base image ===========>
vskumar@ubuntu:~$ sudo docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
hello-world latest f2a91732366c 12 days ago 1.85kB
ubuntu 16.04 20c44cd7596f 2 weeks ago 123MB
ubuntu latest 20c44cd7596f 2 weeks ago 123MB
vskumar@ubuntu:~$ sudo docker rmi 20c44cd7596f
Error response from daemon: conflict: unable to delete 20c44cd7596f (must be forced) – image is referenced in multiple repositories
vskumar@ubuntu:~$
=========================>
Both ubuntu images are interlinked and they can not be removed as the base docker engine is working on top of their OS.

We will stop this session at this time.

We will continue some more sessions on “dockerfile”.

 

Vcard-Shanthi Kumar V-v3

13. DevOps: Working with dockerfile to build apache2 container

Docker-logo

In continuation of my previous session on :”12. DevOps: How to build docker images using dockerfile ? ”, in this session I would like to demonstrate the exercises on:

Working with dockerfile to build apache2 container:

In this exercise, I would like to build a container with apache2 web server setup.

Finally, at the end of this exercise; you will see Apache2 web page running from firefox browser in a docker container.

Note: If you want to recollect the docker commands to be used during your current lab practice, visit my blog link:

https://vskumarblogs.wordpress.com/2017/12/13/some-useful-docker-commands-for-handling-images-and-containers/
Now, I want to create a separate directory as below:

====================>

vskumar@ubuntu:~$ pwd

/home/vskumar

vskumar@ubuntu:~$

vskumar@ubuntu:~$ mkdir apache1

vskumar@ubuntu:~$ cd apache1

vskumar@ubuntu:~/apache1$ pwd

/home/vskumar/apache1

vskumar@ubuntu:~/apache1$

====================>

To install apache2 on ubuntu16.04, let us analyze the steps as below:

Step 1: Install Apache

To install appache2 on unbuntu we can use the following commands:

sudo apt-get update sudo apt-get install apache2

We need to include the above commands in dockerfile.

Let me use the overall commands in the dockerfile as below:

======== You can see the current dockerfile, which will be used ====>

vskumar@ubuntu:~/apache1$ pwd

/home/vskumar/apache1

vskumar@ubuntu:~/apache1$ ls

dockerfile

vskumar@ubuntu:~/apache1$ cat dockerfile

FROM ubuntu:16.04

MAINTAINER “Vskumar” <vskumar35@gmail.com>

RUN apt-get update && apt-get clean

RUN apt-get -y install apache2 && apt-get clean

RUN echo “Apache running!!” >> /var/www/html/index.html

# We have used the base image of ubuntu 16.04

# update all

# cleaned all

# We have installed Apache

# We have echoed a message as Apache is running

# into index.html file

EXPOSE 80

# WE have allocated the port # 80 to apache2

vskumar@ubuntu:~/apache1$

====The above lines are from  dockerfile to install apache2 in Ubuntu container ====>

So, the above dockerfile purpose is;

  1. It builds the container of ubuntu 16.04 with the maintainer name “vskumar”.
  2. It updates the current libs/packages.
  3. It installs the apache2.
  4. It sends a message
  5. It allocates port # 80, with EXPOSE command.

Now, let us run this build as below and review the output:

=============== Installing apache2 on ubuntu container with dockerfile =====>

vskumar@ubuntu:~/apache1$ sudo docker build -t ubuntu16.04/apache2 .

Sending build context to Docker daemon 2.048kB

Step 1/6 : FROM ubuntu:16.04

—> 20c44cd7596f

Step 2/6 : MAINTAINER “Vskumar” <vskumar35@gmail.com>

—> Running in e7c786e9d724

Removing intermediate container e7c786e9d724

—> de795f3ddd1f

Step 3/6 : RUN apt-get update && apt-get clean

—> Running in 712d867e5412

Get:1 http://security.ubuntu.com/ubuntu xenial-security InRelease [102 kB]

Get:2 http://archive.ubuntu.com/ubuntu xenial InRelease [247 kB]

Get:3 http://archive.ubuntu.com/ubuntu xenial-updates InRelease [102 kB]

Get:4 http://archive.ubuntu.com/ubuntu xenial-backports InRelease [102 kB]

Get:5 http://archive.ubuntu.com/ubuntu xenial/universe Sources [9802 kB]

Get:6 http://security.ubuntu.com/ubuntu xenial-security/universe Sources [53.1 kB]

Get:7 http://security.ubuntu.com/ubuntu xenial-security/main amd64 Packages [505 kB]

Get:8 http://security.ubuntu.com/ubuntu xenial-security/restricted amd64 Packages [12.9 kB]

Get:9 http://security.ubuntu.com/ubuntu xenial-security/universe amd64 Packages [229 kB]

Get:10 http://security.ubuntu.com/ubuntu xenial-security/multiverse amd64 Packages [3479 B]

Get:11 http://archive.ubuntu.com/ubuntu xenial/main amd64 Packages [1558 kB]

Get:12 http://archive.ubuntu.com/ubuntu xenial/restricted amd64 Packages [14.1 kB]

Get:13 http://archive.ubuntu.com/ubuntu xenial/universe amd64 Packages [9827 kB]

Get:14 http://archive.ubuntu.com/ubuntu xenial/multiverse amd64 Packages [176 kB]

Get:15 http://archive.ubuntu.com/ubuntu xenial-updates/universe Sources [231 kB]

Get:16 http://archive.ubuntu.com/ubuntu xenial-updates/main amd64 Packages [866 kB]

Get:17 http://archive.ubuntu.com/ubuntu xenial-updates/restricted amd64 Packages [13.7 kB]

Get:18 http://archive.ubuntu.com/ubuntu xenial-updates/universe amd64 Packages [719 kB]

Get:19 http://archive.ubuntu.com/ubuntu xenial-updates/multiverse amd64 Packages [18.5 kB]

Get:20 http://archive.ubuntu.com/ubuntu xenial-backports/main amd64 Packages [5174 B]

Get:21 http://archive.ubuntu.com/ubuntu xenial-backports/universe amd64 Packages [7150 B]

Fetched 24.6 MB in 29s (825 kB/s)

Reading package lists…

Removing intermediate container 712d867e5412

—> 1780fbb9121e

Step 4/6 : RUN apt-get -y install apache2 && apt-get clean

—> Running in d9e9198a3e05

Reading package lists…

Building dependency tree…

Reading state information…

The following additional packages will be installed:

apache2-bin apache2-data apache2-utils file ifupdown iproute2

isc-dhcp-client isc-dhcp-common libapr1 libaprutil1 libaprutil1-dbd-sqlite3

libaprutil1-ldap libasn1-8-heimdal libatm1 libdns-export162 libexpat1

libffi6 libgdbm3 libgmp10 libgnutls30 libgssapi3-heimdal libhcrypto4-heimdal

libheimbase1-heimdal libheimntlm0-heimdal libhogweed4 libhx509-5-heimdal

libicu55 libidn11 libisc-export160 libkrb5-26-heimdal libldap-2.4-2

liblua5.1-0 libmagic1 libmnl0 libnettle6 libp11-kit0 libperl5.22

libroken18-heimdal libsasl2-2 libsasl2-modules libsasl2-modules-db

libsqlite3-0 libssl1.0.0 libtasn1-6 libwind0-heimdal libxml2 libxtables11

mime-support netbase openssl perl perl-modules-5.22 rename sgml-base

ssl-cert xml-core

Suggested packages:

www-browser apache2-doc apache2-suexec-pristine | apache2-suexec-custom ufw

ppp rdnssd iproute2-doc resolvconf avahi-autoipd isc-dhcp-client-ddns

apparmor gnutls-bin libsasl2-modules-otp libsasl2-modules-ldap

libsasl2-modules-sql libsasl2-modules-gssapi-mit

| libsasl2-modules-gssapi-heimdal ca-certificates perl-doc

libterm-readline-gnu-perl | libterm-readline-perl-perl make sgml-base-doc

openssl-blacklist debhelper

The following NEW packages will be installed:

apache2 apache2-bin apache2-data apache2-utils file ifupdown iproute2

isc-dhcp-client isc-dhcp-common libapr1 libaprutil1 libaprutil1-dbd-sqlite3

libaprutil1-ldap libasn1-8-heimdal libatm1 libdns-export162 libexpat1

libffi6 libgdbm3 libgmp10 libgnutls30 libgssapi3-heimdal libhcrypto4-heimdal

libheimbase1-heimdal libheimntlm0-heimdal libhogweed4 libhx509-5-heimdal

libicu55 libidn11 libisc-export160 libkrb5-26-heimdal libldap-2.4-2

liblua5.1-0 libmagic1 libmnl0 libnettle6 libp11-kit0 libperl5.22

libroken18-heimdal libsasl2-2 libsasl2-modules libsasl2-modules-db

libsqlite3-0 libssl1.0.0 libtasn1-6 libwind0-heimdal libxml2 libxtables11

mime-support netbase openssl perl perl-modules-5.22 rename sgml-base

ssl-cert xml-core

0 upgraded, 57 newly installed, 0 to remove and 2 not upgraded.

Need to get 22.7 MB of archives.

After this operation, 102 MB of additional disk space will be used.

Get:1 http://archive.ubuntu.com/ubuntu xenial/main amd64 libatm1 amd64 1:2.5.1-1.5 [24.2 kB]

Get:2 http://archive.ubuntu.com/ubuntu xenial/main amd64 libmnl0 amd64 1.0.3-5 [12.0 kB]

Get:3 http://archive.ubuntu.com/ubuntu xenial/main amd64 libgdbm3 amd64 1.8.3-13.1 [16.9 kB]

Get:4 http://archive.ubuntu.com/ubuntu xenial/main amd64 sgml-base all 1.26+nmu4ubuntu1 [12.5 kB]

Get:5 http://archive.ubuntu.com/ubuntu xenial-updates/main amd64 perl-modules-5.22 all 5.22.1-9ubuntu0.2 [2661 kB]

Get:6 http://archive.ubuntu.com/ubuntu xenial-updates/main amd64 libperl5.22 amd64 5.22.1-9ubuntu0.2 [3391 kB]

Get:7 http://archive.ubuntu.com/ubuntu xenial-updates/main amd64 perl amd64 5.22.1-9ubuntu0.2 [237 kB]

Get:8 http://archive.ubuntu.com/ubuntu xenial/main amd64 mime-support all 3.59ubuntu1 [31.0 kB]

Get:9 http://archive.ubuntu.com/ubuntu xenial/main amd64 libapr1 amd64 1.5.2-3 [86.0 kB]

Get:10 http://archive.ubuntu.com/ubuntu xenial-updates/main amd64 libexpat1 amd64 2.1.0-7ubuntu0.16.04.3 [71.2 kB]

Get:11 http://archive.ubuntu.com/ubuntu xenial-updates/main amd64 libssl1.0.0 amd64 1.0.2g-1ubuntu4.9 [1085 kB]

Get:12 http://archive.ubuntu.com/ubuntu xenial/main amd64 libaprutil1 amd64 1.5.4-1build1 [77.1 kB]

Get:13 http://archive.ubuntu.com/ubuntu xenial/main amd64 libsqlite3-0 amd64 3.11.0-1ubuntu1 [396 kB]

Get:14 http://archive.ubuntu.com/ubuntu xenial/main amd64 libaprutil1-dbd-sqlite3 amd64 1.5.4-1build1 [10.6 kB]

Get:15 http://archive.ubuntu.com/ubuntu xenial/main amd64 libgmp10 amd64 2:6.1.0+dfsg-2 [240 kB]

Get:16 http://archive.ubuntu.com/ubuntu xenial-updates/main amd64 libnettle6 amd64 3.2-1ubuntu0.16.04.1 [93.5 kB]

Get:17 http://archive.ubuntu.com/ubuntu xenial-updates/main amd64 libhogweed4 amd64 3.2-1ubuntu0.16.04.1 [136 kB]

Get:18 http://archive.ubuntu.com/ubuntu xenial-updates/main amd64 libidn11 amd64 1.32-3ubuntu1.2 [46.5 kB]

Get:19 http://archive.ubuntu.com/ubuntu xenial/main amd64 libffi6 amd64 3.2.1-4 [17.8 kB]

Get:20 http://archive.ubuntu.com/ubuntu xenial-updates/main amd64 libp11-kit0 amd64 0.23.2-5~ubuntu16.04.1 [105 kB]

Get:21 http://archive.ubuntu.com/ubuntu xenial-updates/main amd64 libtasn1-6 amd64 4.7-3ubuntu0.16.04.2 [43.3 kB]

Get:22 http://archive.ubuntu.com/ubuntu xenial-updates/main amd64 libgnutls30 amd64 3.4.10-4ubuntu1.4 [548 kB]

Get:23 http://archive.ubuntu.com/ubuntu xenial-updates/main amd64 libroken18-heimdal amd64 1.7~git20150920+dfsg-4ubuntu1.16.04.1 [41.4 kB]

Get:24 http://archive.ubuntu.com/ubuntu xenial-updates/main amd64 libasn1-8-heimdal amd64 1.7~git20150920+dfsg-4ubuntu1.16.04.1 [174 kB]

Get:25 http://archive.ubuntu.com/ubuntu xenial-updates/main amd64 libhcrypto4-heimdal amd64 1.7~git20150920+dfsg-4ubuntu1.16.04.1 [85.0 kB]

Get:26 http://archive.ubuntu.com/ubuntu xenial-updates/main amd64 libheimbase1-heimdal amd64 1.7~git20150920+dfsg-4ubuntu1.16.04.1 [29.3 kB]

Get:27 http://archive.ubuntu.com/ubuntu xenial-updates/main amd64 libwind0-heimdal amd64 1.7~git20150920+dfsg-4ubuntu1.16.04.1 [47.8 kB]

Get:28 http://archive.ubuntu.com/ubuntu xenial-updates/main amd64 libhx509-5-heimdal amd64 1.7~git20150920+dfsg-4ubuntu1.16.04.1 [107 kB]

Get:29 http://archive.ubuntu.com/ubuntu xenial-updates/main amd64 libkrb5-26-heimdal amd64 1.7~git20150920+dfsg-4ubuntu1.16.04.1 [202 kB]

Get:30 http://archive.ubuntu.com/ubuntu xenial-updates/main amd64 libheimntlm0-heimdal amd64 1.7~git20150920+dfsg-4ubuntu1.16.04.1 [15.1 kB]

Get:31 http://archive.ubuntu.com/ubuntu xenial-updates/main amd64 libgssapi3-heimdal amd64 1.7~git20150920+dfsg-4ubuntu1.16.04.1 [96.1 kB]

Get:32 http://archive.ubuntu.com/ubuntu xenial/main amd64 libsasl2-modules-db amd64 2.1.26.dfsg1-14build1 [14.5 kB]

Get:33 http://archive.ubuntu.com/ubuntu xenial/main amd64 libsasl2-2 amd64 2.1.26.dfsg1-14build1 [48.7 kB]

Get:34 http://archive.ubuntu.com/ubuntu xenial-updates/main amd64 libldap-2.4-2 amd64 2.4.42+dfsg-2ubuntu3.2 [160 kB]

Get:35 http://archive.ubuntu.com/ubuntu xenial/main amd64 libaprutil1-ldap amd64 1.5.4-1build1 [8720 B]

Get:36 http://archive.ubuntu.com/ubuntu xenial/main amd64 liblua5.1-0 amd64 5.1.5-8ubuntu1 [102 kB]

Get:37 http://archive.ubuntu.com/ubuntu xenial-updates/main amd64 libicu55 amd64 55.1-7ubuntu0.3 [7658 kB]

Get:38 http://archive.ubuntu.com/ubuntu xenial-updates/main amd64 libxml2 amd64 2.9.3+dfsg1-1ubuntu0.3 [697 kB]

Get:39 http://archive.ubuntu.com/ubuntu xenial-updates/main amd64 apache2-bin amd64 2.4.18-2ubuntu3.5 [925 kB]

Get:40 http://archive.ubuntu.com/ubuntu xenial-updates/main amd64 apache2-utils amd64 2.4.18-2ubuntu3.5 [82.3 kB]

Get:41 http://archive.ubuntu.com/ubuntu xenial-updates/main amd64 apache2-data all 2.4.18-2ubuntu3.5 [162 kB]

Get:42 http://archive.ubuntu.com/ubuntu xenial-updates/main amd64 apache2 amd64 2.4.18-2ubuntu3.5 [86.7 kB]

Get:43 http://archive.ubuntu.com/ubuntu xenial/main amd64 libmagic1 amd64 1:5.25-2ubuntu1 [216 kB]

Get:44 http://archive.ubuntu.com/ubuntu xenial/main amd64 file amd64 1:5.25-2ubuntu1 [21.2 kB]

Get:45 http://archive.ubuntu.com/ubuntu xenial-updates/main amd64 iproute2 amd64 4.3.0-1ubuntu3.16.04.2 [522 kB]

Get:46 http://archive.ubuntu.com/ubuntu xenial-updates/main amd64 ifupdown amd64 0.8.10ubuntu1.2 [54.9 kB]

Get:47 http://archive.ubuntu.com/ubuntu xenial-updates/main amd64 libisc-export160 amd64 1:9.10.3.dfsg.P4-8ubuntu1.9 [153 kB]

Get:48 http://archive.ubuntu.com/ubuntu xenial-updates/main amd64 libdns-export162 amd64 1:9.10.3.dfsg.P4-8ubuntu1.9 [666 kB]

Get:49 http://archive.ubuntu.com/ubuntu xenial-updates/main amd64 isc-dhcp-client amd64 4.3.3-5ubuntu12.7 [223 kB]

Get:50 http://archive.ubuntu.com/ubuntu xenial-updates/main amd64 isc-dhcp-common amd64 4.3.3-5ubuntu12.7 [105 kB]

Get:51 http://archive.ubuntu.com/ubuntu xenial/main amd64 libxtables11 amd64 1.6.0-2ubuntu3 [27.2 kB]

Get:52 http://archive.ubuntu.com/ubuntu xenial/main amd64 netbase all 5.3 [12.9 kB]

Get:53 http://archive.ubuntu.com/ubuntu xenial/main amd64 libsasl2-modules amd64 2.1.26.dfsg1-14build1 [47.5 kB]

Get:54 http://archive.ubuntu.com/ubuntu xenial-updates/main amd64 openssl amd64 1.0.2g-1ubuntu4.9 [492 kB]

Get:55 http://archive.ubuntu.com/ubuntu xenial/main amd64 xml-core all 0.13+nmu2 [23.3 kB]

Get:56 http://archive.ubuntu.com/ubuntu xenial/main amd64 rename all 0.20-4 [12.0 kB]

Get:57 http://archive.ubuntu.com/ubuntu xenial/main amd64 ssl-cert all 1.0.37 [16.9 kB]

debconf: delaying package configuration, since apt-utils is not installed

Fetched 22.7 MB in 1min 49s (206 kB/s)

Selecting previously unselected package libatm1:amd64.

(Reading database … 4768 files and directories currently installed.)

Preparing to unpack …/libatm1_1%3a2.5.1-1.5_amd64.deb …

Unpacking libatm1:amd64 (1:2.5.1-1.5) …

Selecting previously unselected package libmnl0:amd64.

Preparing to unpack …/libmnl0_1.0.3-5_amd64.deb …

Unpacking libmnl0:amd64 (1.0.3-5) …

Selecting previously unselected package libgdbm3:amd64.

Preparing to unpack …/libgdbm3_1.8.3-13.1_amd64.deb …

Unpacking libgdbm3:amd64 (1.8.3-13.1) …

Selecting previously unselected package sgml-base.

Preparing to unpack …/sgml-base_1.26+nmu4ubuntu1_all.deb …

Unpacking sgml-base (1.26+nmu4ubuntu1) …

Selecting previously unselected package perl-modules-5.22.

Preparing to unpack …/perl-modules-5.22_5.22.1-9ubuntu0.2_all.deb …

Unpacking perl-modules-5.22 (5.22.1-9ubuntu0.2) …

Selecting previously unselected package libperl5.22:amd64.

Preparing to unpack …/libperl5.22_5.22.1-9ubuntu0.2_amd64.deb …

Unpacking libperl5.22:amd64 (5.22.1-9ubuntu0.2) …

Selecting previously unselected package perl.

Preparing to unpack …/perl_5.22.1-9ubuntu0.2_amd64.deb …

Unpacking perl (5.22.1-9ubuntu0.2) …

Selecting previously unselected package mime-support.

Preparing to unpack …/mime-support_3.59ubuntu1_all.deb …

Unpacking mime-support (3.59ubuntu1) …

Selecting previously unselected package libapr1:amd64.

Preparing to unpack …/libapr1_1.5.2-3_amd64.deb …

Unpacking libapr1:amd64 (1.5.2-3) …

Selecting previously unselected package libexpat1:amd64.

Preparing to unpack …/libexpat1_2.1.0-7ubuntu0.16.04.3_amd64.deb …

Unpacking libexpat1:amd64 (2.1.0-7ubuntu0.16.04.3) …

Selecting previously unselected package libssl1.0.0:amd64.

Preparing to unpack …/libssl1.0.0_1.0.2g-1ubuntu4.9_amd64.deb …

Unpacking libssl1.0.0:amd64 (1.0.2g-1ubuntu4.9) …

Selecting previously unselected package libaprutil1:amd64.

Preparing to unpack …/libaprutil1_1.5.4-1build1_amd64.deb …

Unpacking libaprutil1:amd64 (1.5.4-1build1) …

Selecting previously unselected package libsqlite3-0:amd64.

Preparing to unpack …/libsqlite3-0_3.11.0-1ubuntu1_amd64.deb …

Unpacking libsqlite3-0:amd64 (3.11.0-1ubuntu1) …

Selecting previously unselected package libaprutil1-dbd-sqlite3:amd64.

Preparing to unpack …/libaprutil1-dbd-sqlite3_1.5.4-1build1_amd64.deb …

Unpacking libaprutil1-dbd-sqlite3:amd64 (1.5.4-1build1) …

Selecting previously unselected package libgmp10:amd64.

Preparing to unpack …/libgmp10_2%3a6.1.0+dfsg-2_amd64.deb …

Unpacking libgmp10:amd64 (2:6.1.0+dfsg-2) …

Selecting previously unselected package libnettle6:amd64.

Preparing to unpack …/libnettle6_3.2-1ubuntu0.16.04.1_amd64.deb …

Unpacking libnettle6:amd64 (3.2-1ubuntu0.16.04.1) …

Selecting previously unselected package libhogweed4:amd64.

Preparing to unpack …/libhogweed4_3.2-1ubuntu0.16.04.1_amd64.deb …

Unpacking libhogweed4:amd64 (3.2-1ubuntu0.16.04.1) …

Selecting previously unselected package libidn11:amd64.

Preparing to unpack …/libidn11_1.32-3ubuntu1.2_amd64.deb …

Unpacking libidn11:amd64 (1.32-3ubuntu1.2) …

Selecting previously unselected package libffi6:amd64.

Preparing to unpack …/libffi6_3.2.1-4_amd64.deb …

Unpacking libffi6:amd64 (3.2.1-4) …

Selecting previously unselected package libp11-kit0:amd64.

Preparing to unpack …/libp11-kit0_0.23.2-5~ubuntu16.04.1_amd64.deb …

Unpacking libp11-kit0:amd64 (0.23.2-5~ubuntu16.04.1) …

Selecting previously unselected package libtasn1-6:amd64.

Preparing to unpack …/libtasn1-6_4.7-3ubuntu0.16.04.2_amd64.deb …

Unpacking libtasn1-6:amd64 (4.7-3ubuntu0.16.04.2) …

Selecting previously unselected package libgnutls30:amd64.

Preparing to unpack …/libgnutls30_3.4.10-4ubuntu1.4_amd64.deb …

Unpacking libgnutls30:amd64 (3.4.10-4ubuntu1.4) …

Selecting previously unselected package libroken18-heimdal:amd64.

Preparing to unpack …/libroken18-heimdal_1.7~git20150920+dfsg-4ubuntu1.16.04.1_amd64.deb …

Unpacking libroken18-heimdal:amd64 (1.7~git20150920+dfsg-4ubuntu1.16.04.1) …

Selecting previously unselected package libasn1-8-heimdal:amd64.

Preparing to unpack …/libasn1-8-heimdal_1.7~git20150920+dfsg-4ubuntu1.16.04.1_amd64.deb …

Unpacking libasn1-8-heimdal:amd64 (1.7~git20150920+dfsg-4ubuntu1.16.04.1) …

Selecting previously unselected package libhcrypto4-heimdal:amd64.

Preparing to unpack …/libhcrypto4-heimdal_1.7~git20150920+dfsg-4ubuntu1.16.04.1_amd64.deb …

Unpacking libhcrypto4-heimdal:amd64 (1.7~git20150920+dfsg-4ubuntu1.16.04.1) …

Selecting previously unselected package libheimbase1-heimdal:amd64.

Preparing to unpack …/libheimbase1-heimdal_1.7~git20150920+dfsg-4ubuntu1.16.04.1_amd64.deb …

Unpacking libheimbase1-heimdal:amd64 (1.7~git20150920+dfsg-4ubuntu1.16.04.1) …

Selecting previously unselected package libwind0-heimdal:amd64.

Preparing to unpack …/libwind0-heimdal_1.7~git20150920+dfsg-4ubuntu1.16.04.1_amd64.deb …

Unpacking libwind0-heimdal:amd64 (1.7~git20150920+dfsg-4ubuntu1.16.04.1) …

Selecting previously unselected package libhx509-5-heimdal:amd64.

Preparing to unpack …/libhx509-5-heimdal_1.7~git20150920+dfsg-4ubuntu1.16.04.1_amd64.deb …

Unpacking libhx509-5-heimdal:amd64 (1.7~git20150920+dfsg-4ubuntu1.16.04.1) …

Selecting previously unselected package libkrb5-26-heimdal:amd64.

Preparing to unpack …/libkrb5-26-heimdal_1.7~git20150920+dfsg-4ubuntu1.16.04.1_amd64.deb …

Unpacking libkrb5-26-heimdal:amd64 (1.7~git20150920+dfsg-4ubuntu1.16.04.1) …

Selecting previously unselected package libheimntlm0-heimdal:amd64.

Preparing to unpack …/libheimntlm0-heimdal_1.7~git20150920+dfsg-4ubuntu1.16.04.1_amd64.deb …

Unpacking libheimntlm0-heimdal:amd64 (1.7~git20150920+dfsg-4ubuntu1.16.04.1) …

Selecting previously unselected package libgssapi3-heimdal:amd64.

Preparing to unpack …/libgssapi3-heimdal_1.7~git20150920+dfsg-4ubuntu1.16.04.1_amd64.deb …

Unpacking libgssapi3-heimdal:amd64 (1.7~git20150920+dfsg-4ubuntu1.16.04.1) …

Selecting previously unselected package libsasl2-modules-db:amd64.

Preparing to unpack …/libsasl2-modules-db_2.1.26.dfsg1-14build1_amd64.deb …

Unpacking libsasl2-modules-db:amd64 (2.1.26.dfsg1-14build1) …

Selecting previously unselected package libsasl2-2:amd64.

Preparing to unpack …/libsasl2-2_2.1.26.dfsg1-14build1_amd64.deb …

Unpacking libsasl2-2:amd64 (2.1.26.dfsg1-14build1) …

Selecting previously unselected package libldap-2.4-2:amd64.

Preparing to unpack …/libldap-2.4-2_2.4.42+dfsg-2ubuntu3.2_amd64.deb …

Unpacking libldap-2.4-2:amd64 (2.4.42+dfsg-2ubuntu3.2) …

Selecting previously unselected package libaprutil1-ldap:amd64.

Preparing to unpack …/libaprutil1-ldap_1.5.4-1build1_amd64.deb …

Unpacking libaprutil1-ldap:amd64 (1.5.4-1build1) …

Selecting previously unselected package liblua5.1-0:amd64.

Preparing to unpack …/liblua5.1-0_5.1.5-8ubuntu1_amd64.deb …

Unpacking liblua5.1-0:amd64 (5.1.5-8ubuntu1) …

Selecting previously unselected package libicu55:amd64.

Preparing to unpack …/libicu55_55.1-7ubuntu0.3_amd64.deb …

Unpacking libicu55:amd64 (55.1-7ubuntu0.3) …

Selecting previously unselected package libxml2:amd64.

Preparing to unpack …/libxml2_2.9.3+dfsg1-1ubuntu0.3_amd64.deb …

Unpacking libxml2:amd64 (2.9.3+dfsg1-1ubuntu0.3) …

Selecting previously unselected package apache2-bin.

Preparing to unpack …/apache2-bin_2.4.18-2ubuntu3.5_amd64.deb …

Unpacking apache2-bin (2.4.18-2ubuntu3.5) …

Selecting previously unselected package apache2-utils.

Preparing to unpack …/apache2-utils_2.4.18-2ubuntu3.5_amd64.deb …

Unpacking apache2-utils (2.4.18-2ubuntu3.5) …

Selecting previously unselected package apache2-data.

Preparing to unpack …/apache2-data_2.4.18-2ubuntu3.5_all.deb …

Unpacking apache2-data (2.4.18-2ubuntu3.5) …

Selecting previously unselected package apache2.

Preparing to unpack …/apache2_2.4.18-2ubuntu3.5_amd64.deb …

Unpacking apache2 (2.4.18-2ubuntu3.5) …

Selecting previously unselected package libmagic1:amd64.

Preparing to unpack …/libmagic1_1%3a5.25-2ubuntu1_amd64.deb …

Unpacking libmagic1:amd64 (1:5.25-2ubuntu1) …

Selecting previously unselected package file.

Preparing to unpack …/file_1%3a5.25-2ubuntu1_amd64.deb …

Unpacking file (1:5.25-2ubuntu1) …

Selecting previously unselected package iproute2.

Preparing to unpack …/iproute2_4.3.0-1ubuntu3.16.04.2_amd64.deb …

Unpacking iproute2 (4.3.0-1ubuntu3.16.04.2) …

Selecting previously unselected package ifupdown.

Preparing to unpack …/ifupdown_0.8.10ubuntu1.2_amd64.deb …

Unpacking ifupdown (0.8.10ubuntu1.2) …

Selecting previously unselected package libisc-export160.

Preparing to unpack …/libisc-export160_1%3a9.10.3.dfsg.P4-8ubuntu1.9_amd64.deb …

Unpacking libisc-export160 (1:9.10.3.dfsg.P4-8ubuntu1.9) …

Selecting previously unselected package libdns-export162.

Preparing to unpack …/libdns-export162_1%3a9.10.3.dfsg.P4-8ubuntu1.9_amd64.deb …

Unpacking libdns-export162 (1:9.10.3.dfsg.P4-8ubuntu1.9) …

Selecting previously unselected package isc-dhcp-client.

Preparing to unpack …/isc-dhcp-client_4.3.3-5ubuntu12.7_amd64.deb …

Unpacking isc-dhcp-client (4.3.3-5ubuntu12.7) …

Selecting previously unselected package isc-dhcp-common.

Preparing to unpack …/isc-dhcp-common_4.3.3-5ubuntu12.7_amd64.deb …

Unpacking isc-dhcp-common (4.3.3-5ubuntu12.7) …

Selecting previously unselected package libxtables11:amd64.

Preparing to unpack …/libxtables11_1.6.0-2ubuntu3_amd64.deb …

Unpacking libxtables11:amd64 (1.6.0-2ubuntu3) …

Selecting previously unselected package netbase.

Preparing to unpack …/archives/netbase_5.3_all.deb …

Unpacking netbase (5.3) …

Selecting previously unselected package libsasl2-modules:amd64.

Preparing to unpack …/libsasl2-modules_2.1.26.dfsg1-14build1_amd64.deb …

Unpacking libsasl2-modules:amd64 (2.1.26.dfsg1-14build1) …

Selecting previously unselected package openssl.

Preparing to unpack …/openssl_1.0.2g-1ubuntu4.9_amd64.deb …

Unpacking openssl (1.0.2g-1ubuntu4.9) …

Selecting previously unselected package xml-core.

Preparing to unpack …/xml-core_0.13+nmu2_all.deb …

Unpacking xml-core (0.13+nmu2) …

Selecting previously unselected package rename.

Preparing to unpack …/archives/rename_0.20-4_all.deb …

Unpacking rename (0.20-4) …

Selecting previously unselected package ssl-cert.

Preparing to unpack …/ssl-cert_1.0.37_all.deb …

Unpacking ssl-cert (1.0.37) …

Processing triggers for libc-bin (2.23-0ubuntu9) …

Processing triggers for systemd (229-4ubuntu21) …

Setting up libatm1:amd64 (1:2.5.1-1.5) …

Setting up libmnl0:amd64 (1.0.3-5) …

Setting up libgdbm3:amd64 (1.8.3-13.1) …

Setting up sgml-base (1.26+nmu4ubuntu1) …

Setting up perl-modules-5.22 (5.22.1-9ubuntu0.2) …

Setting up libperl5.22:amd64 (5.22.1-9ubuntu0.2) …

Setting up perl (5.22.1-9ubuntu0.2) …

update-alternatives: using /usr/bin/prename to provide /usr/bin/rename (rename) in auto mode

Setting up mime-support (3.59ubuntu1) …

Setting up libapr1:amd64 (1.5.2-3) …

Setting up libexpat1:amd64 (2.1.0-7ubuntu0.16.04.3) …

Setting up libssl1.0.0:amd64 (1.0.2g-1ubuntu4.9) …

debconf: unable to initialize frontend: Dialog

debconf: (TERM is not set, so the dialog frontend is not usable.)

debconf: falling back to frontend: Readline

Setting up libaprutil1:amd64 (1.5.4-1build1) …

Setting up libsqlite3-0:amd64 (3.11.0-1ubuntu1) …

Setting up libaprutil1-dbd-sqlite3:amd64 (1.5.4-1build1) …

Setting up libgmp10:amd64 (2:6.1.0+dfsg-2) …

Setting up libnettle6:amd64 (3.2-1ubuntu0.16.04.1) …

Setting up libhogweed4:amd64 (3.2-1ubuntu0.16.04.1) …

Setting up libidn11:amd64 (1.32-3ubuntu1.2) …

Setting up libffi6:amd64 (3.2.1-4) …

Setting up libp11-kit0:amd64 (0.23.2-5~ubuntu16.04.1) …

Setting up libtasn1-6:amd64 (4.7-3ubuntu0.16.04.2) …

Setting up libgnutls30:amd64 (3.4.10-4ubuntu1.4) …

Setting up libroken18-heimdal:amd64 (1.7~git20150920+dfsg-4ubuntu1.16.04.1) …

Setting up libasn1-8-heimdal:amd64 (1.7~git20150920+dfsg-4ubuntu1.16.04.1) …

Setting up libhcrypto4-heimdal:amd64 (1.7~git20150920+dfsg-4ubuntu1.16.04.1) …

Setting up libheimbase1-heimdal:amd64 (1.7~git20150920+dfsg-4ubuntu1.16.04.1) …

Setting up libwind0-heimdal:amd64 (1.7~git20150920+dfsg-4ubuntu1.16.04.1) …

Setting up libhx509-5-heimdal:amd64 (1.7~git20150920+dfsg-4ubuntu1.16.04.1) …

Setting up libkrb5-26-heimdal:amd64 (1.7~git20150920+dfsg-4ubuntu1.16.04.1) …

Setting up libheimntlm0-heimdal:amd64 (1.7~git20150920+dfsg-4ubuntu1.16.04.1) …

Setting up libgssapi3-heimdal:amd64 (1.7~git20150920+dfsg-4ubuntu1.16.04.1) …

Setting up libsasl2-modules-db:amd64 (2.1.26.dfsg1-14build1) …

Setting up libsasl2-2:amd64 (2.1.26.dfsg1-14build1) …

Setting up libldap-2.4-2:amd64 (2.4.42+dfsg-2ubuntu3.2) …

Setting up libaprutil1-ldap:amd64 (1.5.4-1build1) …

Setting up liblua5.1-0:amd64 (5.1.5-8ubuntu1) …

Setting up libicu55:amd64 (55.1-7ubuntu0.3) …

Setting up libxml2:amd64 (2.9.3+dfsg1-1ubuntu0.3) …

Setting up apache2-bin (2.4.18-2ubuntu3.5) …

Setting up apache2-utils (2.4.18-2ubuntu3.5) …

Setting up apache2-data (2.4.18-2ubuntu3.5) …

Setting up apache2 (2.4.18-2ubuntu3.5) …

Enabling module mpm_event.

Enabling module authz_core.

Enabling module authz_host.

Enabling module authn_core.

Enabling module auth_basic.

Enabling module access_compat.

Enabling module authn_file.

Enabling module authz_user.

Enabling module alias.

Enabling module dir.

Enabling module autoindex.

Enabling module env.

Enabling module mime.

Enabling module negotiation.

Enabling module setenvif.

Enabling module filter.

Enabling module deflate.

Enabling module status.

Enabling conf charset.

Enabling conf localized-error-pages.

Enabling conf other-vhosts-access-log.

Enabling conf security.

Enabling conf serve-cgi-bin.

Enabling site 000-default.

invoke-rc.d: could not determine current runlevel

invoke-rc.d: policy-rc.d denied execution of start.

Setting up libmagic1:amd64 (1:5.25-2ubuntu1) …

Setting up file (1:5.25-2ubuntu1) …

Setting up iproute2 (4.3.0-1ubuntu3.16.04.2) …

Setting up ifupdown (0.8.10ubuntu1.2) …

Creating /etc/network/interfaces.

Setting up libisc-export160 (1:9.10.3.dfsg.P4-8ubuntu1.9) …

Setting up libdns-export162 (1:9.10.3.dfsg.P4-8ubuntu1.9) …

Setting up isc-dhcp-client (4.3.3-5ubuntu12.7) …

Setting up isc-dhcp-common (4.3.3-5ubuntu12.7) …

Setting up libxtables11:amd64 (1.6.0-2ubuntu3) …

Setting up netbase (5.3) …

Setting up libsasl2-modules:amd64 (2.1.26.dfsg1-14build1) …

Setting up openssl (1.0.2g-1ubuntu4.9) …

Setting up xml-core (0.13+nmu2) …

Setting up rename (0.20-4) …

update-alternatives: using /usr/bin/file-rename to provide /usr/bin/rename (rename) in auto mode

Setting up ssl-cert (1.0.37) …

debconf: unable to initialize frontend: Dialog

debconf: (TERM is not set, so the dialog frontend is not usable.)

debconf: falling back to frontend: Readline

Processing triggers for libc-bin (2.23-0ubuntu9) …

Processing triggers for systemd (229-4ubuntu21) …

Processing triggers for sgml-base (1.26+nmu4ubuntu1) …

Removing intermediate container d9e9198a3e05

—> 80596dd5c11e

Step 5/6 : RUN echo “Apache running!!” >> /var/www/html/index.html

—> Running in 2b2892574b8c

Removing intermediate container 2b2892574b8c

—> 4559135d9b47

Step 6/6 : EXPOSE 80

—> Running in 9427afe144bb

Removing intermediate container 9427afe144bb

—> 17334a666342

Successfully built 17334a666342

Successfully tagged ubuntu16.04/apache2:latest

vskumar@ubuntu:~/apache1$

=============== You can see the contained id:17334a666342 ====>

Without error it has been built with tagged ubuntu16.04/apache2:latest.

Step 2: Check the Apache image

Let me list the current images:

=========== Current docker images ====>

vskumar@ubuntu:~/apache1$

vskumar@ubuntu:~/apache1$ sudo docker images

REPOSITORY TAG IMAGE ID CREATED SIZE

ubuntu16.04/apache2 latest 17334a666342 8 minutes ago 261MB

ubuntu 16.04 20c44cd7596f 2 weeks ago 123MB

ubuntu latest 20c44cd7596f 2 weeks ago 123MB

vskumar@ubuntu:~/apache1$

===============================>

Now, Let us check the docker networks.

======= Docker networks list ======>

vskumar@ubuntu:~/apache1$ sudo docker network ls

NETWORK ID NAME DRIVER SCOPE

c16796e9072f bridge bridge local

b12df1d5fa4c host host local

70b971906469 none null local

vskumar@ubuntu:~/apache1$

=========================>

For containers network specifications, please visit:

https://docs.docker.com/engine/userguide/networking/#the-default-bridge-network

Step 3: Connect the Apache container/image with network

Now to get the services connected through docker bridge we need to connect the containers to the network bridge as below:
==== Named the latest image as container1 connected to default bridge ====>

vskumar@ubuntu:~/apache1$ sudo docker run -itd –name=container1 ubuntu16.04/apache2

6df11fd4bbffa4c41fcef86bb314c8796d663827cf85321b6bbc2a803d0de58b

vskumar@ubuntu:~/apache1$

==========================>

Now let us inspect the networks as below:

====== See the above image is attached to the bridge network as below =======>

vskumar@ubuntu:~/apache1$

vskumar@ubuntu:~/apache1$ sudo docker network inspect bridge

[

{

“Name”: “bridge”,

“Id”: “c16796e9072f2a9bd3273ee6733260a7be8c34cc72099eb496180d75e4298bf8”,

“Created”: “2017-12-04T03:17:49.732438566-08:00”,

“Scope”: “local”,

“Driver”: “bridge”,

“EnableIPv6”: false,

“IPAM”: {

“Driver”: “default”,

“Options”: null,

“Config”: [

{

“Subnet”: “172.17.0.0/16”,

“Gateway”: “172.17.0.1”

}

]

},

“Internal”: false,

“Attachable”: false,

“Ingress”: false,

“ConfigFrom”: {

“Network”: “”

},

“ConfigOnly”: false,

“Containers”: {

“6df11fd4bbffa4c41fcef86bb314c8796d663827cf85321b6bbc2a803d0de58b”: {

“Name”: “container1”,

“EndpointID”: “fa1b98a6a8455d7bcbe3260672123dd9ba6339cec25b4992031d5815ba48affa”,

“MacAddress”: “02:42:ac:11:00:02”,

“IPv4Address”: “172.17.0.2/16”,

“IPv6Address”: “”

}

},

“Options”: {

“com.docker.network.bridge.default_bridge”: “true”,

“com.docker.network.bridge.enable_icc”: “true”,

“com.docker.network.bridge.enable_ip_masquerade”: “true”,

“com.docker.network.bridge.host_binding_ipv4”: “0.0.0.0”,

“com.docker.network.bridge.name”: “docker0”,

“com.docker.network.driver.mtu”: “1500”

},

“Labels”: {}

}

]

vskumar@ubuntu:~/apache1$

=============================>

Observe the contaner1, section. Its ip is recorded.

Let us start the container now:

=================>

vskumar@ubuntu:~/apache1$ sudo docker run -i -t fedora/jenkins bin/bash

root@6df11fd4bbff:/#

root@6df11fd4bbff:/# ls

bin dev home lib64 mnt proc run srv tmp var

boot etc lib media opt root sbin sys usr

root@6df11fd4bbff:/#

================>

Let us check its /etc/hosts file contents.

=============================>

root@6df11fd4bbff:/# cat /etc/hosts

127.0.0.1 localhost

::1 localhost ip6-localhost ip6-loopback

fe00::0 ip6-localnet

ff00::0 ip6-mcastprefix

ff02::1 ip6-allnodes

ff02::2 ip6-allrouters

172.17.0.2 6df11fd4bbff

root@6df11fd4bbff:/#

=============================>

Let us add some packages to this container.

To curl to any IP, we need curl utility on this container.

======== Installing curl utility on container1 ====>

root@6df11fd4bbff:/# apt-get install curl

Reading package lists… Done

Building dependency tree

Reading state information… Done

The following additional packages will be installed:

ca-certificates krb5-locales libcurl3-gnutls libgssapi-krb5-2 libk5crypto3 libkeyutils1

libkrb5-3 libkrb5support0 librtmp1

Suggested packages:

krb5-doc krb5-user

The following NEW packages will be installed:

ca-certificates curl krb5-locales libcurl3-gnutls libgssapi-krb5-2 libk5crypto3 libkeyutils1

libkrb5-3 libkrb5support0 librtmp1

0 upgraded, 10 newly installed, 0 to remove and 2 not upgraded.

Need to get 1072 kB of archives.

After this operation, 6220 kB of additional disk space will be used.

Do you want to continue? [Y/n] y

Get:1 http://archive.ubuntu.com/ubuntu xenial-updates/main amd64 ca-certificates all 20170717~16.04.1 [168 kB]

Get:2 http://archive.ubuntu.com/ubuntu xenial-updates/main amd64 krb5-locales all 1.13.2+dfsg-5ubuntu2 [13.2 kB]

Get:3 http://archive.ubuntu.com/ubuntu xenial-updates/main amd64 libkrb5support0 amd64 1.13.2+dfsg-5ubuntu2 [30.8 kB]

Get:4 http://archive.ubuntu.com/ubuntu xenial-updates/main amd64 libk5crypto3 amd64 1.13.2+dfsg-5ubuntu2 [81.2 kB]

Get:5 http://archive.ubuntu.com/ubuntu xenial/main amd64 libkeyutils1 amd64 1.5.9-8ubuntu1 [9904 B]

Get:6 http://archive.ubuntu.com/ubuntu xenial-updates/main amd64 libkrb5-3 amd64 1.13.2+dfsg-5ubuntu2 [273 kB]

Get:7 http://archive.ubuntu.com/ubuntu xenial-updates/main amd64 libgssapi-krb5-2 amd64 1.13.2+dfsg-5ubuntu2 [120 kB]

Get:8 http://archive.ubuntu.com/ubuntu xenial-updates/main amd64 librtmp1 amd64 2.4+20151223.gitfa8646d-1ubuntu0.1 [54.4 kB]

Get:9 http://archive.ubuntu.com/ubuntu xenial-updates/main amd64 libcurl3-gnutls amd64 7.47.0-1ubuntu2.5 [184 kB]

Get:10 http://archive.ubuntu.com/ubuntu xenial-updates/main amd64 curl amd64 7.47.0-1ubuntu2.5 [138 kB]

Fetched 1072 kB in 3s (272 kB/s)

debconf: delaying package configuration, since apt-utils is not installed

Selecting previously unselected package ca-certificates.

(Reading database … 7907 files and directories currently installed.)

Preparing to unpack …/ca-certificates_20170717~16.04.1_all.deb …

Unpacking ca-certificates (20170717~16.04.1) …

Selecting previously unselected package krb5-locales.

Preparing to unpack …/krb5-locales_1.13.2+dfsg-5ubuntu2_all.deb …

Unpacking krb5-locales (1.13.2+dfsg-5ubuntu2) …

Selecting previously unselected package libkrb5support0:amd64.

Preparing to unpack …/libkrb5support0_1.13.2+dfsg-5ubuntu2_amd64.deb …

Unpacking libkrb5support0:amd64 (1.13.2+dfsg-5ubuntu2) …

Selecting previously unselected package libk5crypto3:amd64.

Preparing to unpack …/libk5crypto3_1.13.2+dfsg-5ubuntu2_amd64.deb …

Unpacking libk5crypto3:amd64 (1.13.2+dfsg-5ubuntu2) …

Selecting previously unselected package libkeyutils1:amd64.

Preparing to unpack …/libkeyutils1_1.5.9-8ubuntu1_amd64.deb …

Unpacking libkeyutils1:amd64 (1.5.9-8ubuntu1) …

Selecting previously unselected package libkrb5-3:amd64.

Preparing to unpack …/libkrb5-3_1.13.2+dfsg-5ubuntu2_amd64.deb …

Unpacking libkrb5-3:amd64 (1.13.2+dfsg-5ubuntu2) …

Selecting previously unselected package libgssapi-krb5-2:amd64.

Preparing to unpack …/libgssapi-krb5-2_1.13.2+dfsg-5ubuntu2_amd64.deb …

Unpacking libgssapi-krb5-2:amd64 (1.13.2+dfsg-5ubuntu2) …

Selecting previously unselected package librtmp1:amd64.

Preparing to unpack …/librtmp1_2.4+20151223.gitfa8646d-1ubuntu0.1_amd64.deb …

Unpacking librtmp1:amd64 (2.4+20151223.gitfa8646d-1ubuntu0.1) …

Selecting previously unselected package libcurl3-gnutls:amd64.

Preparing to unpack …/libcurl3-gnutls_7.47.0-1ubuntu2.5_amd64.deb …

Unpacking libcurl3-gnutls:amd64 (7.47.0-1ubuntu2.5) …

Selecting previously unselected package curl.

Preparing to unpack …/curl_7.47.0-1ubuntu2.5_amd64.deb …

Unpacking curl (7.47.0-1ubuntu2.5) …

Processing triggers for libc-bin (2.23-0ubuntu9) …

Setting up ca-certificates (20170717~16.04.1) …

debconf: unable to initialize frontend: Dialog

debconf: (No usable dialog-like program is installed, so the dialog based frontend cannot be used. at /usr/share/perl5/Debconf/FrontEnd/Dialog.pm line 76.)

debconf: falling back to frontend: Readline

Setting up krb5-locales (1.13.2+dfsg-5ubuntu2) …

Setting up libkrb5support0:amd64 (1.13.2+dfsg-5ubuntu2) …

Setting up libk5crypto3:amd64 (1.13.2+dfsg-5ubuntu2) …

Setting up libkeyutils1:amd64 (1.5.9-8ubuntu1) …

Setting up libkrb5-3:amd64 (1.13.2+dfsg-5ubuntu2) …

Setting up libgssapi-krb5-2:amd64 (1.13.2+dfsg-5ubuntu2) …

Setting up librtmp1:amd64 (2.4+20151223.gitfa8646d-1ubuntu0.1) …

Setting up libcurl3-gnutls:amd64 (7.47.0-1ubuntu2.5) …

Setting up curl (7.47.0-1ubuntu2.5) …

Processing triggers for ca-certificates (20170717~16.04.1) …

Updating certificates in /etc/ssl/certs…

148 added, 0 removed; done.

Running hooks in /etc/ca-certificates/update.d…

done.

Processing triggers for libc-bin (2.23-0ubuntu9) …

root@6df11fd4bbff:/#

================= End of curl installation ====>

Step 4: Check the container connectivity in docker network

Now, let me ping this container from the docker host to check its connectivity.

===========================>

vskumar@ubuntu:~$

vskumar@ubuntu:~$ ping 172.17.0.2

PING 172.17.0.2 (172.17.0.2) 56(84) bytes of data.

From 172.17.0.1 icmp_seq=9 Destination Host Unreachable

From 172.17.0.1 icmp_seq=10 Destination Host Unreachable

From 172.17.0.1 icmp_seq=11 Destination Host Unreachable

From 172.17.0.1 icmp_seq=12 Destination Host Unreachable

From 172.17.0.1 icmp_seq=13 Destination Host Unreachable

From 172.17.0.1 icmp_seq=14 Destination Host Unreachable

From 172.17.0.1 icmp_seq=15 Destination Host Unreachable

^C

— 172.17.0.2 ping statistics —

30 packets transmitted, 0 received, +7 errors, 100% packet loss, time 29695ms

pipe 15

vskumar@ubuntu:~$

========= It means communication is established to Docker host/engine ======>
Now, let me exit the container interactive sessions as below:

===========  Exit container1  ======>

root@6df11fd4bbff:/#

root@6df11fd4bbff:/# exit

exit

vskumar@ubuntu:~/apache1$

===========================>

Now let me ping this container1 from docker host as below and check the results:

===========================>

vskumar@ubuntu:~$

vskumar@ubuntu:~$ ping 172.17.0.2

PING 172.17.0.2 (172.17.0.2) 56(84) bytes of data.

From 172.17.0.1 icmp_seq=9 Destination Host Unreachable

From 172.17.0.1 icmp_seq=10 Destination Host Unreachable

From 172.17.0.1 icmp_seq=11 Destination Host Unreachable

From 172.17.0.1 icmp_seq=12 Destination Host Unreachable

From 172.17.0.1 icmp_seq=13 Destination Host Unreachable

From 172.17.0.1 icmp_seq=14 Destination Host Unreachable

From 172.17.0.1 icmp_seq=15 Destination Host Unreachable

^C

— 172.17.0.2 ping statistics —

30 packets transmitted, 0 received, +7 errors, 100% packet loss, time 29695ms

pipe 15

vskumar@ubuntu:~$

==== It shows unreachable due to the container1 is stopped =====>

Now let us check the containers status as below:

===== Containers status ======>

vskumar@ubuntu:~$ sudo docker ps -a

[sudo] password for vskumar:

CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES

6df11fd4bbff ubuntu16.04/apache2 “/bin/bash” 35 minutes ago Exited (0) 7 minutes ago container1

76ccfb044dd1 ubuntu16.04/apache2 “/bin/bash” About an hour ago Exited (0) About an hour ago upbeat_chandrasekhar

vskumar@ubuntu:~$

========= So it shows as Container1 is exited =====>

The outcome of this exercise  is; to know whenever the container is running, can we ping to it.

Let us try to run the container in non-interactive mode and check its ping status:

======================>

vskumar@ubuntu:~/apache1$

vskumar@ubuntu:~/apache1$ sudo docker start container1

container1

vskumar@ubuntu:~/apache1$ sudo docker ps -a

CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES

6df11fd4bbff ubuntu16.04/apache2 “/bin/bash” 38 minutes ago Up 5 seconds 80/tcp container1

76ccfb044dd1 ubuntu16.04/apache2 “/bin/bash” About an hour ago Exited (0) About an hour ago upbeat_chandrasekhar

vskumar@ubuntu:~/apache1$

===================>

It shows as replying from it :

====== Pinging the non-interactive container ====>

vskumar@ubuntu:~$

vskumar@ubuntu:~$ ping 172.17.0.2

PING 172.17.0.2 (172.17.0.2) 56(84) bytes of data.

64 bytes from 172.17.0.2: icmp_seq=1 ttl=64 time=0.296 ms

64 bytes from 172.17.0.2: icmp_seq=2 ttl=64 time=0.161 ms

64 bytes from 172.17.0.2: icmp_seq=3 ttl=64 time=0.142 ms

64 bytes from 172.17.0.2: icmp_seq=4 ttl=64 time=0.147 ms

64 bytes from 172.17.0.2: icmp_seq=5 ttl=64 time=0.144 ms

64 bytes from 172.17.0.2: icmp_seq=6 ttl=64 time=0.145 ms

^C

— 172.17.0.2 ping statistics —

6 packets transmitted, 6 received, 0% packet loss, time 5113ms

rtt min/avg/max/mdev = 0.142/0.172/0.296/0.057 ms

vskumar@ubuntu:~$

===============================>

So we have seen its communication by both modes; interactive and non-interactive.

Now, let us check the status of apache2 on container1 and make it ‘active’ as below from the interactive mode:

========== Apache2 status on container1 ======>

root@6df11fd4bbff:/#

root@6df11fd4bbff:/#

root@6df11fd4bbff:/# service apache2 status

* apache2 is not running

root@6df11fd4bbff:/# service apache2 start

* Starting Apache httpd web server apache2 AH00558: apache2: Could not reliably determine the server’s fully qualified domain name, using 172.17.0.2. Set the ‘ServerName’ directive globally to suppress this message

*

root@6df11fd4bbff:/# service apache2 status

* apache2 is running

root@6df11fd4bbff:/#

======================>

Step 5: Check the Apache home page with the container ip in ubuntu host machine’s Firefox browser:

Now I want to go to my ubuntu host cloud machine and use the firefox browser to access the apache2 page. Let me try. Yes it is running well with ip address: 172.17.0.2, as a proof you can see the below images:

Apache2-container-page1.png

Apache2-container-page2.png

It is a great work we have done! we proved the container networking can be done well with docker containers.

From the ubuntu cloud host machine we have seen the above screenshot from apache2 web page. Please check the web page bottom message ‘Apache running!! ‘. This is the message given through ‘echo’ command in the dockerfile.

If you want to stop the service you can use the below command:

=============== Stopping apache2 sever =====>

root@6df11fd4bbff:/# service apache2 stop

* Stopping Apache httpd web server apache2 *

root@6df11fd4bbff:/# service apache2 status

* apache2 is not running

root@6df11fd4bbff:/#

==============================>

Now, check your browser. You should get the message as “Unable to connect”.

You need to restart as below to run the web page:

root@6df11fd4bbff:/# service apache2 start

* Starting Apache httpd web server apache2 AH00558: apache2: Could not reliably determine the server’s fully qualified domain name, using 172.17.0.2. Set the ‘ServerName’ directive globally to suppress this message

root@6df11fd4bbff:/# service apache2 status

* apache2 is running

root@6df11fd4bbff:/#

=================== Restarted apache2 ============>

At this point, I want to stop this session.

In the next session, we will see some more examples with dockerfile usage to build containers.

Vcard-Shanthi Kumar V-v3

1. Graph database: How to install Neo4j [3.2.6] on ubuntu

Neo4j

In continuation of my previous blogs on DevOps tools. In this blog I would like to demonstrate on “Installation of Neo4j 3.2.6 Graph database on Ubuntu” with screen outputs for each command.

Installation of Neo4j for ubuntu

Assuming you have the Ubuntu cloud machine setup and following this session.

Step1: Install JDK

We need to install JDK before installing Neo4j.

add-apt-repository ppa:webupd8team/java

================================>

vskumar@ubuntu:~$ sudo add-apt-repository ppa:webupd8team/java
Oracle Java (JDK) Installer (automatically downloads and installs Oracle JDK7 / JDK8 / JDK9). There are no actual Java files in this PPA.

Important -> Why Oracle Java 7 And 6 Installers No Longer Work: http://www.webupd8.org/2017/06/why-oracle-java-7-and-6-installers-no.html

Ubuntu 16.10 Yakkety Yak is no longer supported by Canonical (and thus, Launchpad and this PPA). The PPA supports Ubuntu 17.10, 17.04, 16.04, 14.04 and 12.04.

More info (and Ubuntu installation instructions):
– for Oracle Java 7: http://www.webupd8.org/2012/01/install-oracle-java-jdk-7-in-ubuntu-via.html
– for Oracle Java 8: http://www.webupd8.org/2012/09/install-oracle-java-8-in-ubuntu-via-ppa.html

Debian installation instructions:
– Oracle Java 7: http://www.webupd8.org/2012/06/how-to-install-oracle-java-7-in-debian.html
– Oracle Java 8: http://www.webupd8.org/2014/03/how-to-install-oracle-java-8-in-debian.html

Oracle Java 9 (for both Ubuntu and Debian): http://www.webupd8.org/2015/02/install-oracle-java-9-in-ubuntu-linux.html

Oracle JDK 9 is now considered stable. There are currently only 64bit builds (no other builds are available for download: http://www.oracle.com/technetwork/java/javase/downloads/index.html )
More info: https://launchpad.net/~webupd8team/+archive/ubuntu/java
Press [ENTER] to continue or ctrl-c to cancel adding it

gpg: keyring `/tmp/tmp_l64cwdq/secring.gpg’ created
gpg: keyring `/tmp/tmp_l64cwdq/pubring.gpg’ created
gpg: requesting key EEA14886 from hkp server keyserver.ubuntu.com
gpg: /tmp/tmp_l64cwdq/trustdb.gpg: trustdb created
gpg: key EEA14886: public key “Launchpad VLC” imported
gpg: no ultimately trusted keys found
gpg: Total number processed: 1
gpg: imported: 1 (RSA: 1)
OK
vskumar@ubuntu:~$ ^C
vskumar@ubuntu:~$
==============================>

Now, we can update the Ubuntu packages as below:

=============== Let us update as below =====>
vskumar@ubuntu:~$ sudo apt-get -f install
Reading package lists… Done
Building dependency tree
Reading state information… Done
Correcting dependencies… Done
The following packages were automatically installed and are no longer required:
bridge-utils containerd runc ubuntu-fan
Use ‘sudo apt autoremove’ to remove them.
The following additional packages will be installed:
linux-headers-4.10.0-42-generic linux-headers-generic-hwe-16.04
The following NEW packages will be installed:
linux-headers-4.10.0-42-generic
The following packages will be upgraded:
linux-headers-generic-hwe-16.04
1 upgraded, 1 newly installed, 0 to remove and 145 not upgraded.
6 not fully installed or removed.
Need to get 682 kB of archives.
After this operation, 7,550 kB of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 http://us.archive.ubuntu.com/ubuntu xenial-updates/main amd64 linux-headers-4.10.0-42-generic amd64 4.10.0-42.46~16.04.1 [680 kB]
Get:2 http://us.archive.ubuntu.com/ubuntu xenial-updates/main amd64 linux-headers-generic-hwe-16.04 amd64 4.10.0.42.44 [2,330 B]
Fetched 682 kB in 1s (494 kB/s)
Selecting previously unselected package linux-headers-4.10.0-42-generic.
(Reading database … 235799 files and directories currently installed.)
Preparing to unpack …/linux-headers-4.10.0-42-generic_4.10.0-42.46~16.04.1_amd64.deb …
Unpacking linux-headers-4.10.0-42-generic (4.10.0-42.46~16.04.1) …
Preparing to unpack …/linux-headers-generic-hwe-16.04_4.10.0.42.44_amd64.deb …
Unpacking linux-headers-generic-hwe-16.04 (4.10.0.42.44) over (4.10.0.40.42) …
Setting up rsync (3.1.1-3ubuntu1.1) …
Setting up linux-image-4.10.0-42-generic (4.10.0-42.46~16.04.1) …
Running depmod.
update-initramfs: deferring update (hook will be called later)
Examining /etc/kernel/postinst.d.
run-parts: executing /etc/kernel/postinst.d/apt-auto-removal 4.10.0-42-generic /boot/vmlinuz-4.10.0-42-generic
run-parts: executing /etc/kernel/postinst.d/initramfs-tools 4.10.0-42-generic /boot/vmlinuz-4.10.0-42-generic
update-initramfs: Generating /boot/initrd.img-4.10.0-42-generic
run-parts: executing /etc/kernel/postinst.d/pm-utils 4.10.0-42-generic /boot/vmlinuz-4.10.0-42-generic
run-parts: executing /etc/kernel/postinst.d/unattended-upgrades 4.10.0-42-generic /boot/vmlinuz-4.10.0-42-generic
run-parts: executing /etc/kernel/postinst.d/update-notifier 4.10.0-42-generic /boot/vmlinuz-4.10.0-42-generic
run-parts: executing /etc/kernel/postinst.d/zz-update-grub 4.10.0-42-generic /boot/vmlinuz-4.10.0-42-generic
Generating grub configuration file …
Warning: Setting GRUB_TIMEOUT to a non-zero value when GRUB_HIDDEN_TIMEOUT is set is no longer supported.
Found linux image: /boot/vmlinuz-4.10.0-42-generic
Found initrd image: /boot/initrd.img-4.10.0-42-generic
Found linux image: /boot/vmlinuz-4.10.0-40-generic
Found initrd image: /boot/initrd.img-4.10.0-40-generic
Found linux image: /boot/vmlinuz-4.10.0-28-generic
Found initrd image: /boot/initrd.img-4.10.0-28-generic
Found memtest86+ image: /boot/memtest86+.elf
Found memtest86+ image: /boot/memtest86+.bin
done
Setting up linux-image-extra-4.10.0-42-generic (4.10.0-42.46~16.04.1) …
run-parts: executing /etc/kernel/postinst.d/apt-auto-removal 4.10.0-42-generic /boot/vmlinuz-4.10.0-42-generic
run-parts: executing /etc/kernel/postinst.d/initramfs-tools 4.10.0-42-generic /boot/vmlinuz-4.10.0-42-generic
update-initramfs: Generating /boot/initrd.img-4.10.0-42-generic
run-parts: executing /etc/kernel/postinst.d/pm-utils 4.10.0-42-generic /boot/vmlinuz-4.10.0-42-generic
run-parts: executing /etc/kernel/postinst.d/unattended-upgrades 4.10.0-42-generic /boot/vmlinuz-4.10.0-42-generic
run-parts: executing /etc/kernel/postinst.d/update-notifier 4.10.0-42-generic /boot/vmlinuz-4.10.0-42-generic
run-parts: executing /etc/kernel/postinst.d/zz-update-grub 4.10.0-42-generic /boot/vmlinuz-4.10.0-42-generic
Generating grub configuration file …
Warning: Setting GRUB_TIMEOUT to a non-zero value when GRUB_HIDDEN_TIMEOUT is set is no longer supported.
Found linux image: /boot/vmlinuz-4.10.0-42-generic
Found initrd image: /boot/initrd.img-4.10.0-42-generic
Found linux image: /boot/vmlinuz-4.10.0-40-generic
Found initrd image: /boot/initrd.img-4.10.0-40-generic
Found linux image: /boot/vmlinuz-4.10.0-28-generic
Found initrd image: /boot/initrd.img-4.10.0-28-generic
Found memtest86+ image: /boot/memtest86+.elf
Found memtest86+ image: /boot/memtest86+.bin
done
Setting up linux-image-generic-hwe-16.04 (4.10.0.42.44) …
Setting up linux-headers-4.10.0-42 (4.10.0-42.46~16.04.1) …
Setting up linux-headers-4.10.0-42-generic (4.10.0-42.46~16.04.1) …
Setting up linux-headers-generic-hwe-16.04 (4.10.0.42.44) …
Setting up linux-generic-hwe-16.04 (4.10.0.42.44) …
vskumar@ubuntu:~$

==================================>

Now, we need to install JDK9.
sudo apt install oracle-java9-installer

[Note: I have already installed JDK 9 in my VM before writing this blog. Hence the output is not copied].

Once the JDK is installed in your machine, check the java version as below:

$ java –version
=============================>
vskumar@ubuntu:~$
vskumar@ubuntu:~$ pwd
/home/vskumar
vskumar@ubuntu:~$ java –version
java 9.0.1
Java(TM) SE Runtime Environment (build 9.0.1+11)
Java HotSpot(TM) 64-Bit Server VM (build 9.0.1+11, mixed mode)
vskumar@ubuntu:~$

=============================>

Once the JDK is confirmed as above steps.

Now, let us start building the Neo4j setup as below steps:

Step2: for Neo4j Setup

Use the below command to install Neo4j.

wget -O – https://debian.neo4j.org/neotechnology.gpg.key | sudo apt-key add –

========= Neo4j =====>
vskumar@ubuntu:~$ wget -O – https://debian.neo4j.org/neotechnology.gpg.key | sudo apt-key add –
–2017-12-08 08:15:11– https://debian.neo4j.org/neotechnology.gpg.key
Resolving debian.neo4j.org (debian.neo4j.org)… 52.0.233.188
Connecting to debian.neo4j.org (debian.neo4j.org)|52.0.233.188|:443… connected.
HTTP request sent, awaiting response… 200 OK
Length: 4791 (4.7K) [application/octet-stream]
Saving to: ‘STDOUT’

– 100%[===================>] 4.68K –.-KB/s in 0s

2017-12-08 08:15:16 (131 MB/s) – written to stdout [4791/4791]

OK
vskumar@ubuntu:~$
===============>

We need to use the below operations for setting up Neo4j:

Use the below pipe :

echo ‘deb http://debian.neo4j.org/repo stable/’ >/tmp/neo4j.list
=====================>
vskumar@ubuntu:~$ echo ‘deb http://debian.neo4j.org/repo stable/’ >/tmp/neo4j.list
vskumar@ubuntu:~$ cat /tmp/neo4j.list
deb http://debian.neo4j.org/repo stable/
vskumar@ubuntu:~$
====================>

Then move the below directory and check its validation:

sudo mv /tmp/neo4j.list /etc/apt/sources.list.d

================>
vskumar@ubuntu:~$
vskumar@ubuntu:~$ sudo mv /tmp/neo4j.list /etc/apt/sources.list.d
vskumar@ubuntu:~$ ls /etc/apt/sources.list.d
docker.list webupd8team-ubuntu-java-xenial.list
docker.list.save webupd8team-ubuntu-java-xenial.list.save
neo4j.list
vskumar@ubuntu:~$ ls -l /etc/apt/sources.list.d
total 20
-rw-r–r– 1 root root 70 Dec 8 04:08 docker.list
-rw-r–r– 1 root root 70 Dec 8 04:08 docker.list.save
-rw-rw-r– 1 vskumar vskumar 41 Dec 8 08:18 neo4j.list
-rw-r–r– 1 root root 207 Dec 8 04:08 webupd8team-ubuntu-java-xenial.list
-rw-r–r– 1 root root 136 Dec 8 04:08 webupd8team-ubuntu-java-xenial.list.save
vskumar@ubuntu:~$ cd /etc
vskumar@ubuntu:/etc$ cd apt
vskumar@ubuntu:/etc/apt$ cd sources
bash: cd: sources: No such file or directory
vskumar@ubuntu:/etc/apt$ cd sources.list.d
vskumar@ubuntu:/etc/apt/sources.list.d$ pwd
/etc/apt/sources.list.d
vskumar@ubuntu:/etc/apt/sources.list.d$ ls
docker.list webupd8team-ubuntu-java-xenial.list
docker.list.save webupd8team-ubuntu-java-xenial.list.save
neo4j.list
vskumar@ubuntu:/etc/apt/sources.list.d$
=============================>

Now, we need to update all dependencies by :
sudo apt-get update //

===================== You will see the huge output =======>

Once its done with ‘ok’ prompt, follow below step.

Now, let us install neo4j using

sudo apt-get install neo4j=3.2.6

==== See the below output =====>
vskumar@ubuntu:/etc/apt/sources.list.d$
vskumar@ubuntu:/etc/apt/sources.list.d$ sudo apt-get install neo4j=3.2.6
Reading package lists… Done
Building dependency tree
Reading state information… Done
The following packages were automatically installed and are no longer required:
bridge-utils containerd linux-headers-4.10.0-28
linux-headers-4.10.0-28-generic linux-image-4.10.0-28-generic
linux-image-extra-4.10.0-28-generic runc ubuntu-fan
Use ‘sudo apt autoremove’ to remove them.
The following additional packages will be installed:
cypher-shell daemon
The following NEW packages will be installed:
cypher-shell daemon neo4j
0 upgraded, 3 newly installed, 0 to remove and 126 not upgraded.
Need to get 76.0 MB/76.9 MB of archives.
After this operation, 88.6 MB of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 http://debian.neo4j.org/repo stable/ neo4j 3.2.6 [76.0 MB]
Fetched 76.0 MB in 1min 34s (801 kB/s)
Selecting previously unselected package daemon.
(Reading database … 252587 files and directories currently installed.)
Preparing to unpack …/daemon_0.6.4-1_amd64.deb …
Unpacking daemon (0.6.4-1) …
Selecting previously unselected package cypher-shell.
Preparing to unpack …/cypher-shell_1.1.2-1_all.deb …
Unpacking cypher-shell (1.1.2-1) …
Selecting previously unselected package neo4j.
Preparing to unpack …/archives/neo4j_3.2.6_all.deb …
Unpacking neo4j (3.2.6) …
Processing triggers for man-db (2.7.5-1) …
Processing triggers for systemd (229-4ubuntu19) …
Processing triggers for ureadahead (0.100.0-19) …
Setting up daemon (0.6.4-1) …
Setting up cypher-shell (1.1.2-1) …
Setting up neo4j (3.2.6) …
Processing triggers for systemd (229-4ubuntu19) …
Processing triggers for ureadahead (0.100.0-19) …
vskumar@ubuntu:/etc/apt/sources.list.d$

====================>

After completing installation process we need to restart neo4j service using the below command.
$sudo service neo4j restart

====================>

vskumar@ubuntu:/etc/apt/sources.list.d$ sudo service neo4j restart
vskumar@ubuntu:/etc/apt/sources.list.d$ sudo service neo4j status
● neo4j.service – Neo4j Graph Database
Loaded: loaded (/lib/systemd/system/neo4j.service; disabled; vendor preset: e
Active: active (running) since Fri 2017-12-08 08:46:14 PST; 7s ago
Main PID: 30856 (java)
Tasks: 8
Memory: 70.6M
CPU: 2.756s
CGroup: /system.slice/neo4j.service
└─30856 /usr/bin/java -cp /var/lib/neo4j/plugins:/etc/neo4j:/usr/shar

Dec 08 08:46:21 ubuntu neo4j[30856]: Directories in use:
Dec 08 08:46:21 ubuntu neo4j[30856]: home: /var/lib/neo4j
Dec 08 08:46:21 ubuntu neo4j[30856]: config: /etc/neo4j
Dec 08 08:46:21 ubuntu neo4j[30856]: logs: /var/log/neo4j
Dec 08 08:46:21 ubuntu neo4j[30856]: plugins: /var/lib/neo4j/plugins
Dec 08 08:46:21 ubuntu neo4j[30856]: import: /var/lib/neo4j/import
Dec 08 08:46:21 ubuntu neo4j[30856]: data: /var/lib/neo4j/data
Dec 08 08:46:21 ubuntu neo4j[30856]: certificates: /var/lib/neo4j/certificates
Dec 08 08:46:21 ubuntu neo4j[30856]: run: /var/run/neo4j
Dec 08 08:46:21 ubuntu neo4j[30856]: Starting Neo4j.

=======================================>

Finally, We can access the Neo4j browser with the below Url:
http://localhost:7474/browser/

Neo4j-browser

Now, we can use for our lab practice with Cypher Queries.

For ; How to install Neo4j on a docker container? [for Ubuntu 18.04 VM]

Visit my blog:

https://vskumar.blog/2018/07/15/2-graph-database-docker-how-to-install-neo4j-on-a-docker-container-for-ubuntu-18-04-vm/

Please leave your feedback!

Vcard-Shanthi Kumar V-v3

11. DevOps: How to Launch a container as a daemon ?

Docker-logo

In continuation of my previous blog on “10. DevOps: How to Build images from Docker containers?”, I am continuing my lab exercises. In this session we can see ”

How to Launch a container as a daemon ?:

Note: If you want to recollect the docker commands to be used during your current lab practice, visit my blog link:

https://vskumarblogs.wordpress.com/2017/12/13/some-useful-docker-commands-for-handling-images-and-containers/

 

Let us recap the past exercises; So far we have experimented with an interactive container, tracked the changes that were made to the containers., created images from the containers, and then gained insights in the containerization scenarios.

Now, let us see the container usage in a detached mode.

When we run the container in a detached mode it runs under a daemon process.

I want to use the “ubuntu” image and run detached mode command.

First, let me check my current docker images:

==================>

vskumar@ubuntu:~$

vskumar@ubuntu:~$ sudo docker images

[sudo] password for vskumar:

REPOSITORY TAG IMAGE ID CREATED SIZE

docker-exercise/ubuntu-wgetinstall latest e34304119838 7 days ago 169MB

<none> <none> fc7e4564eb92 7 days ago 169MB

hello-world latest f2a91732366c 12 days ago 1.85kB

ubuntu 16.04 20c44cd7596f 2 weeks ago 123MB

ubuntu latest 20c44cd7596f 2 weeks ago 123MB

busybox latest 6ad733544a63 4 weeks ago 1.13MB

busybox 1.24 47bcc53f74dc 20 months ago 1.11MB

vskumar@ubuntu:~$

===================>

You can see my previous image with ‘docker-exercise/ubuntu-wgetinstall ‘. This was created in the previous exercise.

As per our plan in this session I am using the below commands to run the ubuntu image as below:

sudo docker run -d ubuntu \

    /bin/bash -c "while true; do date; sleep 5; done";

========== Output ======>
vskumar@ubuntu:~$  sudo docker run -d ubuntu \
>     /bin/bash -c "while true; do date; sleep 5; done";
0fe495fc93edee3aaadc7fc0fbf21997f0ca3cde4d7e563aa8c61352a43957dd
vskumar@ubuntu:~$ $ 
=======================>

Now, to view the docker logs I want to run the docker logs subcommand on image id: ‘ 0fe495fc93edee3aaadc7fc0fbf21997f0ca3cde4d7e563aa8c61352a43957dd’

$ sudo docker logs 0fe495fc93edee3aaadc7fc0fbf21997f0ca3cde4d7e563aa8c61352a43957dd;

=====See the output of the Daemon process running with the ubuntu image ===============>

vskumar@ubuntu:~$ sudo docker logs 0fe495fc93edee3aaadc7fc0fbf21997f0ca3cde4d7e563aa8c61352a43957dd;

Sun Dec 3 05:11:57 UTC 2017

Sun Dec 3 05:12:02 UTC 2017

Sun Dec 3 05:12:07 UTC 2017

Sun Dec 3 05:12:12 UTC 2017

Sun Dec 3 05:12:17 UTC 2017

Sun Dec 3 05:12:22 UTC 2017

Sun Dec 3 05:12:27 UTC 2017

Sun Dec 3 05:12:32 UTC 2017

Sun Dec 3 05:12:37 UTC 2017

Sun Dec 3 05:12:42 UTC 2017

Sun Dec 3 05:12:48 UTC 2017

Sun Dec 3 05:12:53 UTC 2017

Sun Dec 3 05:12:58 UTC 2017

Sun Dec 3 05:13:03 UTC 2017

Sun Dec 3 05:13:08 UTC 2017

Sun Dec 3 05:13:13 UTC 2017

Sun Dec 3 05:13:18 UTC 2017

Sun Dec 3 05:13:23 UTC 2017

Sun Dec 3 05:13:28 UTC 2017

Sun Dec 3 05:13:33 UTC 2017

Sun Dec 3 05:13:38 UTC 2017

Sun Dec 3 05:13:43 UTC 2017

Sun Dec 3 05:13:48 UTC 2017

Sun Dec 3 05:13:53 UTC 2017

Sun Dec 3 05:13:58 UTC 2017

Sun Dec 3 05:14:03 UTC 2017

Sun Dec 3 05:14:08 UTC 2017

Sun Dec 3 05:14:13 UTC 2017

Sun Dec 3 05:14:18 UTC 2017

Sun Dec 3 05:14:23 UTC 2017

Sun Dec 3 05:14:28 UTC 2017

Sun Dec 3 05:14:33 UTC 2017

Sun Dec 3 05:14:38 UTC 2017

Sun Dec 3 05:14:43 UTC 2017

Sun Dec 3 05:14:48 UTC 2017

Sun Dec 3 05:14:53 UTC 2017

Sun Dec 3 05:14:58 UTC 2017

Sun Dec 3 05:15:03 UTC 2017

Sun Dec 3 05:15:08 UTC 2017

Sun Dec 3 05:15:13 UTC 2017

Sun Dec 3 05:15:18 UTC 2017

Sun Dec 3 05:15:23 UTC 2017

vskumar@ubuntu:~$

=================You can see the output for every few seconds listed =======>

It means the container is running as a daemon.

Now, let us use ps -eaf command to check the processed running in linux by using :

$ ps -eaf | grep ‘daemon’

========= See the output of daemon processes ==========>

vskumar@ubuntu:~$

vskumar@ubuntu:~$ ps -eaf | grep ‘daemon’

message+ 837 1 0 20:26 ? 00:00:05 /usr/bin/dbus-daemon –system –address=systemd: –nofork –nopidfile –systemd-activation

root 871 1 0 20:26 ? 00:00:03 /usr/sbin/NetworkManager –no-daemon

avahi 873 1 0 20:26 ? 00:00:00 avahi-daemon: running [ubuntu.local]

root 876 1 0 20:26 ? 00:00:01 /usr/lib/accountsservice/accounts-daemon

avahi 893 873 0 20:26 ? 00:00:00 avahi-daemon: chroot helper

rtkit 1370 1 0 20:28 ? 00:00:00 /usr/lib/rtkit/rtkit-daemon

vskumar 2426 1 0 20:55 ? 00:00:00 /usr/bin/gnome-keyring-daemon –daemonize –login

vskumar 2508 2428 0 20:55 ? 00:00:00 upstart-udev-bridge –daemon –user

vskumar 2515 2428 0 20:55 ? 00:00:04 dbus-daemon –fork –session –address=unix:abstract=/tmp/dbus-nPaV5rWlQc

vskumar 2570 2428 0 20:55 ? 00:00:03 /usr/lib/x86_64-linux-gnu/bamf/bamfdaemon

vskumar 2572 2428 0 20:55 ? 00:00:04 /usr/bin/ibus-daemon –daemonize –xim –address unix:tmpdir=/tmp/ibus

vskumar 2575 2428 0 20:55 ? 00:00:00 upstart-file-bridge –daemon –user

vskumar 2579 2428 0 20:55 ? 00:00:00 upstart-dbus-bridge –daemon –system –user –bus-name system

vskumar 2582 2428 0 20:55 ? 00:00:00 upstart-dbus-bridge –daemon –session –user –bus-name session

vskumar 2605 2428 0 20:55 ? 00:00:00 /usr/lib/ibus/ibus-x11 –kill-daemon

vskumar 2630 2428 0 20:56 ? 00:00:00 gpg-agent –homedir /home/vskumar/.gnupg –use-standard-socket –daemon

vskumar 2645 2428 0 20:56 ? 00:00:02 /usr/lib/unity-settings-daemon/unity-settings-daemon

vskumar 2664 2653 0 20:56 ? 00:00:00 /usr/bin/dbus-daemon –config-file=/etc/at-spi2/accessibility.conf –nofork –print-address 3

vskumar 2851 2654 0 20:56 ? 00:00:01 /usr/lib/unity-settings-daemon/unity-fallback-mount-helper

vskumar 2914 2428 0 20:57 ? 00:00:00 /bin/sh -c /usr/lib/x86_64-linux-gnu/zeitgeist/zeitgeist-maybe-vacuum; /usr/bin/zeitgeist-daemon

vskumar 2920 2914 0 20:57 ? 00:00:00 /usr/bin/zeitgeist-daemon

vskumar 3094 2428 0 21:00 ? 00:00:01 /usr/lib/x86_64-linux-gnu/unity-lens-files/unity-files-daemon

root 4148 1253 0 21:11 ? 00:00:00 docker-containerd-shim –namespace moby –workdir /var/lib/docker/containerd/daemon/io.containerd.runtime.v1.linux/moby/0fe495fc93edee3aaadc7fc0fbf21997f0ca3cde4d7e563aa8c61352a43957dd –address /var/run/docker/containerd/docker-containerd.sock –runtime-root /var/run/docker/runtime-runc

vskumar 4480 3206 0 21:19 pts/19 00:00:00 grep –color=auto daemon

vskumar@ubuntu:~$

======== You can see the list of processes running currently ========>

So we are successful! to run a container in a detached mode [not in an interactive mode!] using the command: ‘ sudo docker run -d ubuntu’

You can think in an application architecture having multiple servers or SOA running with different services.

You can simulate the same services using the docker containers, by setting up as images by configuring the required services and connect them to the architecture.

This way the advantages of containers can be utilized well. Where different companies are using and implementing their applications into containers architecture by saving lot of infrastructure cost. No hardware or physical servers are required. Lot of space also can be saved. The microservices architecture leads to the same way.

At this point, I would like to stop this session and in the next blog we will see other exercises.

Vcard-Shanthi Kumar V-v3

 

 

10. DevOps: How to Build images from Docker containers?

Docker-logo

This is in continuation of my last blog “9. DevOps: How to do Containers housekeeping ?”. In this blog I would like to demonstrate on:

How to Build images from docker containers?:

Note: If you want to recollect the docker commands to be used during your current lab practice, visit my blog link:

https://vskumarblogs.wordpress.com/2017/12/13/some-useful-docker-commands-for-handling-images-and-containers/

So far we have built the containers and operated them through the previous exercises. Now, let us see how  can we add  software to our base image on a running container and then convert that container into an image for future usage.

Let’s take ubuntu:16.04 as our base image, install the wget application, and then convert the running container to an image with the below steps:

To make ubuntu:16.04 container is our base image, we need to install the wget application, and then convert it as the running container to a docker image by using the below steps:

  1. Launch an ubuntu:16.04 container using the docker run subcommand, as shown below:
      $ sudo docker run -i -t ubuntu:16.04 /bin/bash
========================>
vskumar@ubuntu:~$ sudo docker ps -aq
155f4b0764b1
vskumar@ubuntu:~$ sudo docker ps -a
CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS              PORTS               NAMES
155f4b0764b1        ubuntu:16.04        "/bin/bash"         2 hours ago         Up 11 minutes                           zen_volhard
vskumar@ubuntu:~$ sudo docker run -i -t ubuntu:16.04 /bin/bash
root@3484664d454a:/# 
=========================>
2. Now, let's  verify is wget  available for this image or not.
============== the display shows there is no wget in this image =========>

root@3484664d454a:/# ls
bin  boot  dev  etc  home  lib  lib64  media  mnt  opt  proc  root  run  sbin  srv  sys  tmp  usr  var
root@3484664d454a:/# which wget
root@3484664d454a:/# 

      root@472c96295678:/# apt-get update
==================>
As we know that it is a brand new ubuntu container we built it, before installing wget we must synchronize it with the Ubuntu package repository, as shown below:
====================>
root@3484664d454a:/# apt-get update
Get:1 http://archive.ubuntu.com/ubuntu xenial InRelease [247 kB]         
Get:2 http://security.ubuntu.com/ubuntu xenial-security InRelease [102 kB]
Get:3 http://archive.ubuntu.com/ubuntu xenial-updates InRelease [102 kB]                                                                      
Get:4 http://archive.ubuntu.com/ubuntu xenial-backports InRelease [102 kB]                                                                    
Get:5 http://archive.ubuntu.com/ubuntu xenial/universe Sources [9802 kB]                                                                      
Get:6 http://security.ubuntu.com/ubuntu xenial-security/universe Sources [53.1 kB]                                                            
Get:7 http://security.ubuntu.com/ubuntu xenial-security/main amd64 Packages [504 kB]                                                          
Get:8 http://security.ubuntu.com/ubuntu xenial-security/restricted amd64 Packages [12.9 kB]                                                   
Get:9 http://security.ubuntu.com/ubuntu xenial-security/universe amd64 Packages [229 kB]                                                      
Get:10 http://security.ubuntu.com/ubuntu xenial-security/multiverse amd64 Packages [3479 B]                                                   
Get:11 http://archive.ubuntu.com/ubuntu xenial/main amd64 Packages [1558 kB]                                                                  
Get:12 http://archive.ubuntu.com/ubuntu xenial/restricted amd64 Packages [14.1 kB]                                                            
Get:13 http://archive.ubuntu.com/ubuntu xenial/universe amd64 Packages [9827 kB]                                                              
Get:14 http://archive.ubuntu.com/ubuntu xenial/multiverse amd64 Packages [176 kB]                                                             
Get:15 http://archive.ubuntu.com/ubuntu xenial-updates/universe Sources [228 kB]                                                              
Get:16 http://archive.ubuntu.com/ubuntu xenial-updates/main amd64 Packages [864 kB]                                                           
Get:17 http://archive.ubuntu.com/ubuntu xenial-updates/restricted amd64 Packages [13.7 kB]                                                    
Get:18 http://archive.ubuntu.com/ubuntu xenial-updates/universe amd64 Packages [711 kB]                                                       
Get:19 http://archive.ubuntu.com/ubuntu xenial-updates/multiverse amd64 Packages [18.5 kB]                                                    
Get:20 http://archive.ubuntu.com/ubuntu xenial-backports/main amd64 Packages [5174 B]                                                         
Get:21 http://archive.ubuntu.com/ubuntu xenial-backports/universe amd64 Packages [7135 B]                                                     
Fetched 24.6 MB in 59s (412 kB/s)                                                                                                             
Reading package lists... Done
root@3484664d454a:/# 
================================>
Now, we can install wget as below:
=========== Output of wget installation on container ===========>

root@3484664d454a:/# 
root@3484664d454a:/# apt-get install -y wget
Reading package lists... Done
Building dependency tree        
Reading state information... Done
The following additional packages will be installed:
  ca-certificates libidn11 libssl1.0.0 openssl
The following NEW packages will be installed:
  ca-certificates libidn11 libssl1.0.0 openssl wget
0 upgraded, 5 newly installed, 0 to remove and 1 not upgraded.
Need to get 2089 kB of archives.
After this operation, 6027 kB of additional disk space will be used.
Get:1 http://archive.ubuntu.com/ubuntu xenial-updates/main amd64 libidn11 amd64 1.32-3ubuntu1.2 [46.5 kB]
Get:2 http://archive.ubuntu.com/ubuntu xenial-updates/main amd64 libssl1.0.0 amd64 1.0.2g-1ubuntu4.9 [1085 kB]
Get:3 http://archive.ubuntu.com/ubuntu xenial-updates/main amd64 openssl amd64 1.0.2g-1ubuntu4.9 [492 kB]
Get:4 http://archive.ubuntu.com/ubuntu xenial-updates/main amd64 ca-certificates all 20170717~16.04.1 [168 kB]
Get:5 http://archive.ubuntu.com/ubuntu xenial-updates/main amd64 wget amd64 1.17.1-1ubuntu1.3 [299 kB]
Fetched 2089 kB in 4s (421 kB/s)
debconf: delaying package configuration, since apt-utils is not installed
Selecting previously unselected package libidn11:amd64.
(Reading database ... 4768 files and directories currently installed.)
Preparing to unpack .../libidn11_1.32-3ubuntu1.2_amd64.deb ...
Unpacking libidn11:amd64 (1.32-3ubuntu1.2) ...
Selecting previously unselected package libssl1.0.0:amd64.
Preparing to unpack .../libssl1.0.0_1.0.2g-1ubuntu4.9_amd64.deb ...
Unpacking libssl1.0.0:amd64 (1.0.2g-1ubuntu4.9) ...
Selecting previously unselected package openssl.
Preparing to unpack .../openssl_1.0.2g-1ubuntu4.9_amd64.deb ...
Unpacking openssl (1.0.2g-1ubuntu4.9) ...
Selecting previously unselected package ca-certificates.
Preparing to unpack .../ca-certificates_20170717~16.04.1_all.deb ...
Unpacking ca-certificates (20170717~16.04.1) ...
Selecting previously unselected package wget.
Preparing to unpack .../wget_1.17.1-1ubuntu1.3_amd64.deb ...
Unpacking wget (1.17.1-1ubuntu1.3) ...
Processing triggers for libc-bin (2.23-0ubuntu9) ...
Setting up libidn11:amd64 (1.32-3ubuntu1.2) ...
Setting up libssl1.0.0:amd64 (1.0.2g-1ubuntu4.9) ...
debconf: unable to initialize frontend: Dialog
debconf: (No usable dialog-like program is installed, so the dialog based frontend cannot be used. at /usr/share/perl5/Debconf/FrontEnd/Dialog.pm line 76.)
debconf: falling back to frontend: Readline
debconf: unable to initialize frontend: Readline
debconf: (Can't locate Term/ReadLine.pm in @INC (you may need to install the Term::ReadLine module) (@INC contains: /etc/perl /usr/local/lib/x86_64-linux-gnu/perl/5.22.1 /usr/local/share/perl/5.22.1 /usr/lib/x86_64-linux-gnu/perl5/5.22 /usr/share/perl5 /usr/lib/x86_64-linux-gnu/perl/5.22 /usr/share/perl/5.22 /usr/local/lib/site_perl /usr/lib/x86_64-linux-gnu/perl-base .) at /usr/share/perl5/Debconf/FrontEnd/Readline.pm line 7.)
debconf: falling back to frontend: Teletype
Setting up openssl (1.0.2g-1ubuntu4.9) ...
Setting up ca-certificates (20170717~16.04.1) ...
debconf: unable to initialize frontend: Dialog
debconf: (No usable dialog-like program is installed, so the dialog based frontend cannot be used. at /usr/share/perl5/Debconf/FrontEnd/Dialog.pm line 76.)
debconf: falling back to frontend: Readline
debconf: unable to initialize frontend: Readline
debconf: (Can't locate Term/ReadLine.pm in @INC (you may need to install the Term::ReadLine module) (@INC contains: /etc/perl /usr/local/lib/x86_64-linux-gnu/perl/5.22.1 /usr/local/share/perl/5.22.1 /usr/lib/x86_64-linux-gnu/perl5/5.22 /usr/share/perl5 /usr/lib/x86_64-linux-gnu/perl/5.22 /usr/share/perl/5.22 /usr/local/lib/site_perl /usr/lib/x86_64-linux-gnu/perl-base .) at /usr/share/perl5/Debconf/FrontEnd/Readline.pm line 7.)
debconf: falling back to frontend: Teletype
Setting up wget (1.17.1-1ubuntu1.3) ...
Processing triggers for libc-bin (2.23-0ubuntu9) ...
Processing triggers for ca-certificates (20170717~16.04.1) ...
Updating certificates in /etc/ssl/certs...
148 added, 0 removed; done.
Running hooks in /etc/ca-certificates/update.d...
done.
root@3484664d454a:/# 
=========================== End of installation ===========>
Now, we can verify with  'which wget ' command
============>
root@3484664d454a:/# which wget
/usr/bin/wget
root@3484664d454a:/# 
============>
Please let us recollect; installation of any software would alter the Dockwer base image composition. In which, we can also trace using the docker diff subcommand as we did in the previous exercises. 
I will open a second Terminal/screen, the docker diff subcommand can be issued from it, as below:
      $ sudo docker diff 472c96295678
===============>
vskumar@ubuntu:~$  
vskumar@ubuntu:~$ sudo docker ps
CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS              PORTS               NAMES
3484664d454a        ubuntu:16.04        "/bin/bash"         15 minutes ago      Up 15 minutes                           jolly_cray
155f4b0764b1        ubuntu:16.04        "/bin/bash"         2 hours ago         Up 40 minutes                           zen_volhard
vskumar@ubuntu:~$ sudo docker diff 155f4b0764b1
C /root
A /root/.bash_history
vskumar@ubuntu:~$ 
============>

How to save this container ?:
The docker commit subcommand can be performed on a running or a stopped container. When a commit is performed on a running container, the Docker Engine pauses the container during the commit operation in order to avoid any data inconsistency. 
Now we can stop our running container.
We can commit a container to an image with the docker commit subcommand, as shown here:
      $ sudo docker commit 

================== Using commit for container ============>

root@3484664d454a:/# 
root@3484664d454a:/# exit
exit
vskumar@ubuntu:~$ sudo docker commit 3484664d454a
[sudo] password for vskumar: 
Sorry, try again.
[sudo] password for vskumar: 
sha256:fc7e4564eb928ccfe068c789f0d650967e8d5dc42d4e8d92409aab6614364075
vskumar@ubuntu:~$ 
=======================>
You can see the container id from the above output.

=========== We can also give a message to the commit command as below ===>
vskumar@ubuntu:~$ sudo docker commit 3484664d454a  Docker-exercise/ubuntu-wgetinstall
invalid reference format: repository name must be lowercase
vskumar@ubuntu:~$ sudo docker commit 3484664d454a  docker-exercise/ubuntu-wgetinstall
sha256:e34304119838d79da60e12776529106c350b1972cd517648e8ab90311fad7b1a
vskumar@ubuntu:~$ sudo docker ps -a
CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS                       PORTS               NAMES
3484664d454a        ubuntu:16.04        "/bin/bash"         24 minutes ago      Exited (130) 6 minutes ago                       jolly_cray
155f4b0764b1        ubuntu:16.04        "/bin/bash"         2 hours ago         Up About an hour                                 zen_volhard
vskumar@ubuntu:~$ 
===================== Note there are two containers created  ====>
Now, I want to remove one container :
==========>

vskumar@ubuntu:~$ sudo docker rm 3484664d454a
3484664d454a
vskumar@ubuntu:~$ sudo docker ps -a
CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS              PORTS               NAMES
155f4b0764b1        ubuntu:16.04        "/bin/bash"         3 hours ago         Up About an hour                        zen_volhard
vskumar@ubuntu:~$ 
========================>

Now let us check the docker images how many we have in our store :
=========== List of images ==========>
vskumar@ubuntu:~$ 
vskumar@ubuntu:~$ sudo docker images
REPOSITORY                           TAG                 IMAGE ID            CREATED             SIZE
docker-exercise/ubuntu-wgetinstall   latest              e34304119838        5 minutes ago       169MB
<none>                               <none>              fc7e4564eb92        7 minutes ago       169MB
hello-world                          latest              f2a91732366c        5 days ago          1.85kB
ubuntu                               16.04               20c44cd7596f        8 days ago          123MB
ubuntu                               latest              20c44cd7596f        8 days ago          123MB
busybox                              latest              6ad733544a63        3 weeks ago         1.13MB
busybox                              1.24                47bcc53f74dc        20 months ago       1.11MB
vskumar@ubuntu:~$ 

==============================>
How to remove images:

by using :

sudo docker rmi image [image id], we can remove the image. For example; if you want to remove the image id:
47bcc53f74dc
you can use: $ sudo docker rmi image 47bcc53f74dc
=================>
vskumar@ubuntu:~$ sudo docker rmi image 47bcc53f74dc
Untagged: busybox:1.24
Untagged: busybox@sha256:8ea3273d79b47a8b6d018be398c17590a4b5ec604515f416c5b797db9dde3ad8
Deleted: sha256:47bcc53f74dc94b1920f0b34f6036096526296767650f223433fe65c35f149eb
Deleted: sha256:f6075681a244e9df4ab126bce921292673c9f37f71b20f6be1dd3bb99b4fdd72
Deleted: sha256:1834950e52ce4d5a88a1bbd131c537f4d0e56d10ff0dd69e66be3b7dfa9df7e6
Error: No such image: image
vskumar@ubuntu:~$ 
=================>
 

So by using :

sudo docker rmi image [image id], we can remove the image.  Just recollect the difference between the image removal and container removal. For containers removal refer to my blog on "Housekeeping containers". Now we have learned how to create an image from containers using a few easy steps by installing the wget application. You can also add some other software applications to the same or different container(s) in the similar way.

You can use this method for testing also.  Let us say, you want to test a set of java programs. Then you need to install jdk and copy your programs. Write a shell script to compile and execute the programs by piping their output into a text file in a Linux background. So this way, you will be using the container as a test environment also.

The most easy and recommended way of creating an image is to use the Dockerfile method.

Within dockerfile we can mention the setup required to build a container through different steps. Then dockerfile creates the required setup for a container, under docker’s building activity.

We will see it in future exercises.

Please leave your feedback!

Vcard-Shanthi Kumar V-v39. DevOps: How to do Containers housekeeping ?

9. DevOps: How to do Containers housekeeping ?

Docker-logo

In  continuation of my previous blog on “8. DevOps:How to control and operate docker containers”, in this blog I would like to show some lab practice on “docker Containers housekeeping”.

From the previous lab sessions, we have seen many containers when we used ps -a option.

We have used two containers most of the times.

Others are not required. This time we will see how to remove a container physically.

Let us consider the below containers to remove using rm command:

32bc16b508d4        ubuntu 
a744246ffb8e        hello-world
1dd55efde43f        hello-world

$sudo docker rm 1dd55efde43f 
$sudo docker rm a744246ffb8e 
$sudo docker rm 32bc16b508d4 
================ You can see the above three containers are removed =========>
vskumar@ubuntu:~$ sudo docker rm 1dd55efde43f 
1dd55efde43f
vskumar@ubuntu:~$ sudo docker rm a744246ffb8e 
a744246ffb8e
vskumar@ubuntu:~$ sudo docker rm 32bc16b508d4 
32bc16b508d4
vskumar@ubuntu:~$ sudo docker ps -a |more
CONTAINER ID        IMAGE               COMMAND                 CREATED         
    STATUS                         PORTS               NAMES
f123dbd09116        ubuntu:16.04        "/bin/bash"             18 minutes ago  
    Exited (0) 18 minutes ago                          elastic_nightingale
3cfdea29ce6e        ubuntu              "bash"                  27 minutes ago  
    Exited (0) 26 minutes ago                          gallant_nobel
155f4b0764b1        ubuntu:16.04        "/bin/bash"             About an hour ag
o   Exited (0) 12 minutes ago                          zen_volhard
11e293722c64        ubuntu:16.04        "/bin/bash"             About an hour ag
o   Exited (0) About an hour ago                       dreamy_bassi
d10ad2bd62f7        ubuntu:16.04        "/bin/bash"             About an hour ag
o   Exited (0) About an hour ago                       cranky_dijkstra
cb1ff260d48e        ubuntu              "ls /usr/src"           11 hours ago    
    Exited (0) 11 hours ago                            wonderful_hawking
b20691fd8fb5        ubuntu              "ls /usr"               11 hours ago    
    Exited (0) 11 hours ago                            friendly_mirzakhani
431ba4c53028        ubuntu              "ls"                    11 hours ago    
    Exited (0) 28 minutes ago                          affectionate_nobel
2c31684bb1f4        ubuntu              "ls -la"                11 hours ago    
    Exited (0) 11 hours ago                            zealous_meitner
fe2e3b449daf        ubuntu              "ls -la /home/."        11 hours ago    
    Exited (0) 11 hours ago                            dreamy_shirley
c44bdd05b94d        ubuntu              "ls -la home."          11 hours ago    
    Exited (2) 11 hours ago                            elastic_pasteur
8b8afa82859a        ubuntu              "ls -la"                11 hours ago    
    Exited (0) 11 hours ago                            festive_panini
2811eb37af61        ubuntu              "ls -la 604831dbce2a"   11 hours ago    
    Exited (2) 11 hours ago                            jolly_swartz
604831dbce2a        ubuntu:16.04        "/bin/bash"             11 hours ago    
    Exited (0) 11 hours ago                            vibrant_ride
718636415a7f        ubuntu:16.04        "/bin/bash"             12 hours ago    
    Exited (0) 12 hours ago                            reverent_noyce
53a7751d4673        ubuntu:16.04        "/bin/bash"             13 hours ago    
    Exited (0) 13 hours ago                            musing_chandrasekhar
1ba71598b7b8        hello-world         "/hello"                16 hours ago    
    Exited (0) 16 hours ago                            musing_kare
vskumar@ubuntu:~$  
==============>
Now let us consider some more examples  as below:
3cfdea29ce6e        ubuntu 
cb1ff260d48e        ubuntu 
b20691fd8fb5        ubuntu 
431ba4c53028        ubuntu 
c31684bb1f4        ubuntu 
2c31684bb1f4        ubuntu 
fe2e3b449daf        ubuntu
c44bdd05b94d        ubuntu 
2811eb37af61        ubuntu
Now, let us use the below rm commands:
$sudo docker rm 3cfdea29ce6e
$sudo docker rm cb1ff260d48e
$sudo docker rm b20691fd8fb5 
$sudo docker rm 431ba4c53028 
$sudo docker rm 2c31684bb1f4
$sudo docker rm fe2e3b449daf 
$sudo docker rm c44bdd05b94d
$sudo docker rm 2811eb37af61
=================>
See the below output also:
 ================== Container removal ==========>
vskumar@ubuntu:~$ clear

vskumar@ubuntu:~$ sudo docker rm 3cfdea29ce6e
3cfdea29ce6e
vskumar@ubuntu:~$ sudo docker rm cb1ff260d48e
cb1ff260d48e
vskumar@ubuntu:~$ sudo docker rm b20691fd8fb5
b20691fd8fb5
vskumar@ubuntu:~$ sudo docker rm 431ba4c53028
431ba4c53028
vskumar@ubuntu:~$ sudo docker rm 2c31684bb1f4
2c31684bb1f4
vskumar@ubuntu:~$ sudo docker rm fe2e3b449daf
fe2e3b449daf
vskumar@ubuntu:~$ sudo docker rm fc44bdd05b94d
Error: No such container: fc44bdd05b94d
vskumar@ubuntu:~$ sudo docker rm c44bdd05b94d
c44bdd05b94d
vskumar@ubuntu:~$ sudo docker rm 2811eb37af61
2811eb37af61
vskumar@ubuntu:~$ 
==========================>
Now we can see the list of available containers:
============= List of latest containers ==============>
vskumar@ubuntu:~$ sudo docker ps -a |more
CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS                         PORTS               NAMES
f123dbd09116        ubuntu:16.04        "/bin/bash"         28 minutes ago      Exited (0) 28 minutes ago                          elastic_nigh
tingale
155f4b0764b1        ubuntu:16.04        "/bin/bash"         About an hour ago   Exited (0) 22 minutes ago                          zen_volhard
11e293722c64        ubuntu:16.04        "/bin/bash"         About an hour ago   Exited (0) About an hour ago                       dreamy_bassi
d10ad2bd62f7        ubuntu:16.04        "/bin/bash"         2 hours ago         Exited (0) About an hour ago                       cranky_dijks
tra
8b8afa82859a        ubuntu              "ls -la"            11 hours ago        Exited (0) 11 hours ago                            festive_pani
ni
604831dbce2a        ubuntu:16.04        "/bin/bash"         12 hours ago        Exited (0) 11 hours ago                            vibrant_ride
718636415a7f        ubuntu:16.04        "/bin/bash"         12 hours ago        Exited (0) 12 hours ago                            reverent_noy
ce
53a7751d4673        ubuntu:16.04        "/bin/bash"         13 hours ago        Exited (0) 13 hours ago                            musing_chand
rasekhar
1ba71598b7b8        hello-world         "/hello"            16 hours ago        Exited (0) 16 hours ago                            musing_kare
vskumar@ubuntu:~$ 
===========================>
Now, I wan to keep very few containers only and remove the below containers:

604831dbce2a        ubuntu:16.04
718636415a7f        ubuntu:16.04 
53a7751d4673        ubuntu:16.04
8b8afa82859a        ubuntu 
I want to use the below  commands to remove  the above containers:
$sudo docker rm 604831dbce2a
$sudo docker rm 718636415a7f
$sudo docker rm 53a7751d4673
$sudo docker rm 8b8afa82859a

========================= We can see the latest/limited containers =======>
vskumar@ubuntu:~$ sudo docker rm 604831dbce2a
604831dbce2a
vskumar@ubuntu:~$ sudo docker rm 718636415a7f
718636415a7f
vskumar@ubuntu:~$ sudo docker rm 53a7751d4673
53a7751d4673
vskumar@ubuntu:~$ sudo docker rm 8b8afa82859a
8b8afa82859a
vskumar@ubuntu:~$ sudo docker ps -a
CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS                         PORTS               NAMES
f123dbd09116        ubuntu:16.04        "/bin/bash"         36 minutes ago      Exited (0) 36 minutes ago                          elastic_nightingale
155f4b0764b1        ubuntu:16.04        "/bin/bash"         About an hour ago   Exited (0) 30 minutes ago                          zen_volhard
11e293722c64        ubuntu:16.04        "/bin/bash"         About an hour ago   Exited (0) About an hour ago                       dreamy_bassi
d10ad2bd62f7        ubuntu:16.04        "/bin/bash"         2 hours ago         Exited (0) About an hour ago                       cranky_dijkstra
1ba71598b7b8        hello-world         "/hello"            16 hours ago        Exited (0) 16 hours ago                            musing_kare
vskumar@ubuntu:~$ sudo docker ps 
CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS              PORTS               NAMES
vskumar@ubuntu:~$ 
================================>
We can also see the current container ids as below:
========== Listing containers ids ===============>
vskumar@ubuntu:~$ sudo docker ps -aq
f123dbd09116
155f4b0764b1
11e293722c64
d10ad2bd62f7
1ba71598b7b8
vskumar@ubuntu:~$ 
===============================>
To remove the inactive containers there is a prune command. Let us try with it.
Before doing it I want to make a container active and try this prune command on it:
================= I have made one container Active ======>
vskumar@ubuntu:~$ sudo docker ps -a
CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS                         PORTS               NAMES
f123dbd09116        ubuntu:16.04        "/bin/bash"         About an hour ago   Exited (0) About an hour ago                       elastic_nightingale
155f4b0764b1        ubuntu:16.04        "/bin/bash"         2 hours ago         Exited (0) 40 minutes ago                          zen_volhard
11e293722c64        ubuntu:16.04        "/bin/bash"         2 hours ago         Exited (0) 2 hours ago                             dreamy_bassi
d10ad2bd62f7        ubuntu:16.04        "/bin/bash"         2 hours ago         Exited (0) 2 hours ago                             cranky_dijkstra
1ba71598b7b8        hello-world         "/hello"            17 hours ago        Exited (0) 17 hours ago                            musing_kare
vskumar@ubuntu:~$ sudo docker start 155f4b0764b1
155f4b0764b1
vskumar@ubuntu:~$ sudo docker ps 
CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS              PORTS               NAMES
155f4b0764b1        ubuntu:16.04        "/bin/bash"         2 hours ago         Up 6 seconds                            zen_volhard
vskumar@ubuntu:~$ 
========================>
To use prune , below format should be used:
$ sudo docker container prune
=========== The usage of prune command =======>
vskumar@ubuntu:~$ 
vskumar@ubuntu:~$ sudo docker container prune
WARNING! This will remove all stopped containers.
Are you sure you want to continue? [y/N] y
Deleted Containers:
f123dbd09116561a042e12060f449daa9a36d9a59034b1dd1b96846e66ead14d
11e293722c646a0def7a8a1f2cdf85a47654eb62ef7701bd2d7221c7e69a943f
d10ad2bd62f7a8de379272f21dfccec89c0e5829b3a58ce01927530b6b44ea01
1ba71598b7b8d97fcbd3a589a6665238690be99936b6782647b5040eeb82aafa
Total reclaimed space: 844B
vskumar@ubuntu:~$ 
========== You can see the removed container ids =============>
You can see the existing  containers:
====== Available containers after Housekeeping is done =========>
vskumar@ubuntu:~$ 
vskumar@ubuntu:~$ sudo docker ps
CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS              PORTS               NAMES
155f4b0764b1        ubuntu:16.04        "/bin/bash"         2 hours ago         Up 6 minutes                            zen_volhard
vskumar@ubuntu:~$ sudo docker ps -a
CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS              PORTS               NAMES
155f4b0764b1        ubuntu:16.04        "/bin/bash"         2 hours ago         Up 6 minutes                            zen_volhard
vskumar@ubuntu:~$ sudo docker ps -aq
155f4b0764b1
vskumar@ubuntu:~$
===================>
In this exercise we have seen the housekeeping of containers well.
Please note if you have deleted all the containers by mistake, you need to install the containers again. 
Follow the containers creation exercise.

I would like to break this session at this point. In the next blog I would like to present the lab practice on:

 “How to Build images from Docker containers?

Vcard-Shanthi Kumar V


					

8. DevOps:How to control and operate docker containers

Docker-logo

In  continuation of my previous blog on “7. DevOps: How to track changes in a container”, in this blog I would like to show some lab practice “How to control and operate docker containers”.

Controlling/operating Docker container:

In this exercise initially, we can see on how to start/stop/restart the containers.

The Docker Engine enables us to start, stop, and restart a container with a set of docker subcommands.

Let me display the docker images:

=======================>

vskumar@ubuntu:~$ sudo service docker status

docker.service – Docker Application Container Engine

Loaded: loaded (/lib/systemd/system/docker.service; enabled; vendor preset: e

Active: active (running) since Sat 2017-11-25 15:09:35 PST; 2min 24s ago

Docs: https://docs.docker.com

Main PID: 1356 (dockerd)

Tasks: 30

Memory: 95.2M

CPU: 3.998s

=========================>

vskumar@ubuntu:~$ sudo docker images

REPOSITORY TAG IMAGE ID CREATED SIZE

hello-world latest f2a91732366c 4 days ago 1.85kB

ubuntu 16.04 20c44cd7596f 8 days ago 123MB

ubuntu latest 20c44cd7596f 8 days ago 123MB

busybox latest 6ad733544a63 3 weeks ago 1.13MB

busybox 1.24 47bcc53f74dc 20 months ago 1.11MB

vskumar@ubuntu:~$

=======================>

Now, I want to launch our container ubuntu 16.04 with start subcommand and experiment with the docker stop subcommand, as given below:

$ sudo docker run -i -t ubuntu:16.04 /bin/bash

======================>
vskumar@ubuntu:~$ 
vskumar@ubuntu:~$ sudo docker run -i -t ubuntu:16.04 /bin/bash
root@d10ad2bd62f7:/# 
======================>
Now, we are with this container in interactive mode.
Let us apply some linux commands as below:
========================>
root@d10ad2bd62f7:/# pwd
/
root@d10ad2bd62f7:/# ls
bin   dev  home  lib64  mnt  proc  run   srv  tmp  var
boot  etc  lib   media  opt  root  sbin  sys  usr
root@d10ad2bd62f7:/# cd home
root@d10ad2bd62f7:/home# ls
root@d10ad2bd62f7:/home# cd ../var
root@d10ad2bd62f7:/var# ls
backups  cache  lib  local  lock  log  mail  opt  run  spool  tmp
root@d10ad2bd62f7:/var# cd tmp
root@d10ad2bd62f7:/var/tmp# pwd
/var/tmp
root@d10ad2bd62f7:/var/tmp# ls
root@d10ad2bd62f7:/var/tmp# cd ../lib
root@d10ad2bd62f7:/var/lib# ls
apt  dpkg  initscripts  insserv  misc  pam  systemd  update-rc.d  urandom
root@d10ad2bd62f7:/var/lib# 
================================>

Now I want to create a file as below in this container:
==================>

root@d10ad2bd62f7:/var/lib# pwd
/var/lib
root@d10ad2bd62f7:/var/lib# cd ../../home
root@d10ad2bd62f7:/home# ls
root@d10ad2bd62f7:/home# touch file1.txt
===================>

Let me add some text into this file as below:
==========>
root@d10ad2bd62f7:/home# echo " Testing containers " > file1.txt
root@d10ad2bd62f7:/home# echo " Applying stop command on containers " > file1.txt
root@d10ad2bd62f7:/home# cat file1.txt
 Applying stop command on containers 
root@d10ad2bd62f7:/home# echo " Testing containers " > file1.txtroot@d10ad2bd62f7:/home# echo " Applying stop command on containers " >> file1.txt
root@d10ad2bd62f7:/home# ls
file1.txt
root@d10ad2bd62f7:/home# ls -l
total 4
-rw-r--r-- 1 root root 59 Nov 25 23:20 file1.txt
root@d10ad2bd62f7:/home# cat file1.txt 
Testing containers 
Applying stop command on containers 
root@d10ad2bd62f7:/home# 
===============>

I have applied some more linux file operations on this container as below:
=================>
root@d10ad2bd62f7:/home#      
root@d10ad2bd62f7:/home# cat file1.txt >> file2.txt
root@d10ad2bd62f7:/home# ls
file1.txt  file2.txt
root@d10ad2bd62f7:/home# ls -l
total 8
-rw-r--r-- 1 root root 59 Nov 25 23:20 file1.txt
-rw-r--r-- 1 root root 59 Nov 25 23:22 file2.txt
root@d10ad2bd62f7:/home# diff file1.txt file2.txt
root@d10ad2bd62f7:/home# echo " Applying restart command also on containers " >> file1.txt
root@d10ad2bd62f7:/home# ls -l
total 8
-rw-r--r-- 1 root root 105 Nov 25 23:23 file1.txt
-rw-r--r-- 1 root root  59 Nov 25 23:22 file2.txt
root@d10ad2bd62f7:/home# diff file1.txt file2.txt3d2
<  Applying restart command also on containers 
root@d10ad2bd62f7:/home# 
====================>
Now, let me apply a stop command on this container and see as 
below by using exit to come out and stop:
=====================>
root@155f4b0764b1:/# 
root@155f4b0764b1:/# exit
exit
vskumar@ubuntu:~$ sudo docker images
REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE
hello-world         latest              f2a91732366c        4 days ago          1.85kB
ubuntu              16.04               20c44cd7596f        8 days ago          123MB
ubuntu              latest              20c44cd7596f        8 days ago          123MB
busybox             latest              6ad733544a63        3 weeks ago         1.13MB
busybox             1.24                47bcc53f74dc        20 months ago       1.11MB
vskumar@ubuntu:~$ sudo docker stop  d10ad2bd62f7
d10ad2bd62f7
vskumar@ubuntu:~$ 
=============>
Now, I want to check the containers status using ps -a command as below:
==============>
vskumar@ubuntu:~$ sudo docker ps -a
CONTAINER ID        IMAGE               COMMAND                 CREATED             STATUS                     PORTS               NAMES
155f4b0764b1        ubuntu:16.04        "/bin/bash"             2 minutes ago       Exited (0) 2 minutes ago                       zen_volhard
cb1ff260d48e        ubuntu              "ls /usr/src"           10 hours ago        Exited (0) 10 hours ago                        wonderful_hawking
b20691fd8fb5        ubuntu              "ls /usr"               10 hours ago        Exited (0) 10 hours ago                        friendly_mirzakhani
431ba4c53028        ubuntu              "ls"                    10 hours ago        Exited (0) 10 hours ago                        affectionate_nobel
2c31684bb1f4        ubuntu              "ls -la"                10 hours ago        Exited (0) 10 hours ago                        zealous_meitner
fe2e3b449daf        ubuntu              "ls -la /home/."        10 hours ago        Exited (0) 10 hours ago                        dreamy_shirley
c44bdd05b94d        ubuntu              "ls -la home."          10 hours ago        Exited (2) 10 hours ago                        elastic_pasteur
8b8afa82859a        ubuntu              "ls -la"                10 hours ago        Exited (0) 10 hours ago                        festive_panini
2811eb37af61        ubuntu              "ls -la 604831dbce2a"   10 hours ago        Exited (2) 10 hours ago                        jolly_swartz
604831dbce2a        ubuntu:16.04        "/bin/bash"             10 hours ago        Exited (0) 10 hours ago                        vibrant_ride
718636415a7f        ubuntu:16.04        "/bin/bash"             11 hours ago        Exited (0) 10 hours ago                        reverent_noyce
53a7751d4673        ubuntu:16.04        "/bin/bash"             12 hours ago        Exited (0) 12 hours ago                        musing_chandrasekhar
32bc16b508d4        ubuntu              "bash"                  13 hours ago        Exited (0) 13 hours ago                        eager_goldberg
1dd55efde43f        hello-world         "/hello"                13 hours ago        Exited (0) 13 hours ago                        peaceful_pasteur
a744246ffb8e        hello-world         "/hello"                15 hours ago        Exited (0) 15 hours ago                        naughty_wing
1ba71598b7b8        hello-world         "/hello"                15 hours ago        Exited (0) 15 hours ago                        musing_kare
vskumar@ubuntu:~$ 
===================>
you can see the latest status of our container;
155f4b0764b1        ubuntu:16.04        "/bin/bash"             2 minutes ago       Exited (0) 2 minutes ago                       zen_volhard
It means Docker  maintains in the logs on the usage of containers also.
Now, I want to start the previously stopped container using the docker start subcommand 
by specifying the container ID as an argument, as follows:
$ sudo docker start 155f4b0764b1
===============>
vskumar@ubuntu:~$ sudo docker start 155f4b0764b1
155f4b0764b1
vskumar@ubuntu:~$ 
===============>
Let us check the images status also as below:
==================> Copied the 1st two lines only ----->
vskumar@ubuntu:~$ sudo docker ps -a |more
CONTAINER ID        IMAGE               COMMAND                 CREATED         
    STATUS                      PORTS               NAMES
155f4b0764b1        ubuntu:16.04        "/bin/bash"             10 minutes ago  
    Up About a minute                               zen_volhard
11e293722c64        ubuntu:16.04        "/bin/bash"             12 minutes ago  
    Exited (0) 12 minutes ago  
====================>
It means it shows the current status of the container id:155f4b0764b1 
We need to notice one thing here.

By default, the docker start subcommand will not attach to the container.

We can attach it to the container either using the -a option in the docker start subcommand or by explicitly using the docker attach subcommand.

Now let us try these options.

We will see attach command

$ sudo docker attach 155f4b0764b1
=================>
vskumar@ubuntu:~$ 
vskumar@ubuntu:~$ sudo docker attach 155f4b0764b1
root@155f4b0764b1:/# 
root@155f4b0764b1:/#
=================>
So the attach command brought the container into interactive mode.
Now let me exit it and try the -a option with docker start command:
==================>
root@155f4b0764b1:/home# 
root@155f4b0764b1:/home# exit
exit
===============>
with start -a option:
=============>
vskumar@ubuntu:~$ sudo docker start -a 155f4b0764b1
root@155f4b0764b1:/# 
=================>
After exit, I have tried ps command:
=====================>
vskumar@ubuntu:~$ sudo docker ps
CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS              PORTS               NAMES
155f4b0764b1        ubuntu:16.04        "/bin/bash"         21 minutes ago      Up 3 minutes                            zen_volhard
vskumar@ubuntu:~$ 
======================>
From the above display you can see that its start and current status.
It means the container is active and running.
Now, I want to make another [below] container active.
1dd55efde43f        hello-world         "/hello"                13 hours ago Exited (0) 13 hours ago                        peaceful_pasteur
Let us see the ps command after these 2 containers are in active state.
I want to use the below command:
$ sudo docker start -a 1dd55efde43f
===================>
vskumar@ubuntu:~$ sudo docker start -a 1dd55efde43f

Hello from Docker!
This message shows that your installation appears to be working correctly.

To generate this message, Docker took the following steps:
 1. The Docker client contacted the Docker daemon.
 2. The Docker daemon pulled the "hello-world" image from the Docker Hub.
    (amd64)
 3. The Docker daemon created a new container from that image which runs the
    executable that produces the output you are currently reading.
 4. The Docker daemon streamed that output to the Docker client, which sent it
    to your terminal.

Let us  try something more ambitious, we can run an Ubuntu container with:
 $ docker run -it ubuntu bash

If you want to;
Share images, automate workflows, and more with a free Docker ID:
visit: https://cloud.docker.com/
For more examples and ideas, visit:
https://docs.docker.com/engine/userguide/

vskumar@ubuntu:~$ 
===================>
Please note the above container doesn't have a any os related process to 
keep running continuously. 
Just it displays the message only. Hence 
in the list it will not appear. 
Now, let me list the current processes using docker ps command:
===========>
vskumar@ubuntu:~$ sudo docker ps
CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS              PORTS               NAMES
155f4b0764b1        ubuntu:16.04        "/bin/bash"         32 minutes ago      Up 14 minutes                           zen_volhard
vskumar@ubuntu:~$ 
==============>
So as on now one container is running.

The next set of container controlling subcommands are docker pause and docker unpause.

The docker pause subcommand will freeze the execution of all the processes within the container.

The docker unpause subcommand will unfreeze the execution of all the processes within the container and resume the execution from the point where it was frozen.

Let us try the below command 
$sudo docker pause 155f4b0764b1
========================>
vskumar@ubuntu:~$ 
vskumar@ubuntu:~$ sudo docker pause 155f4b0764b1
155f4b0764b1
vskumar@ubuntu:~$ sudo docker ps
CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS                   PORTS               NAMES
155f4b0764b1        ubuntu:16.04        "/bin/bash"         About an hour ago   Up 30 minutes (Paused)                       zen_volhard
vskumar@ubuntu:~$ 
==========================>
You can see the current status as Paused.
Now let me try unpause command also.
$ sudo docker unpause 155f4b0764b1
You can see the total output of this container with pause and unpause statuses:
===================>
vskumar@ubuntu:~$ 
vskumar@ubuntu:~$ sudo docker pause 155f4b0764b1
155f4b0764b1
vskumar@ubuntu:~$ sudo docker ps
CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS                   PORTS               NAMES
155f4b0764b1        ubuntu:16.04        "/bin/bash"         About an hour ago   Up 30 minutes (Paused)                       zen_volhard
vskumar@ubuntu:~$ ^C
vskumar@ubuntu:~$ sudo docker unpause 155f4b0764b1
155f4b0764b1
vskumar@ubuntu:~$ sudo docker ps
CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS              PORTS               NAMES
155f4b0764b1        ubuntu:16.04        "/bin/bash"         About an hour ago   Up 32 minutes                           zen_volhard
vskumar@ubuntu:~$ 
======================>
Now, in this lab session finally we will use the stop command:

The container and the script running within it can be stopped using the docker stop subcommand, as shown below:

$ sudo docker stop 155f4b0764b1
=====================> 
vskumar@ubuntu:~$ sudo docker stop 155f4b0764b1
155f4b0764b1
vskumar@ubuntu:~$ sudo docker ps
CONTAINER ID        IMAGE               COMMAND             CREATED STATUS              PORTS               NAMES
=============== It shows there is no active container =============>
Now, let me try with -a and more options.
=========== Partial display is shown here upto the container ===========>
vskumar@ubuntu:~$ sudo docker ps -a |more
CONTAINER ID        IMAGE               COMMAND                 CREATED         
    STATUS                         PORTS               NAMES
f123dbd09116        ubuntu:16.04        "/bin/bash"             6 minutes ago   
    Exited (0) 5 minutes ago                           elastic_nightingale
3cfdea29ce6e        ubuntu              "bash"                  14 minutes ago  
    Exited (0) 14 minutes ago                          gallant_nobel
155f4b0764b1        ubuntu:16.04        "/bin/bash"             About an hour ag
o   Exited (0) 17 seconds ago  
================================>

So far in this lab session, we have seen the differences of different commands to operate and control the containers. I would like to break this session for now. In the next blog we will see on how to manage “Housekeeping containers“.

 Vcard-Shanthi Kumar V

 

DevOps Practices & FAQs -1

Do you think Agile practices are mandatory to implement DevOps Practices ?

Yes, Agile practices bring Continuous delivery [CD] of business requirements through SPRINT. Then these will be converted into different software code and infrastructure. These will be verified and deployed into the production systems.

Fundamental process of SPRINT is; if user gives a requirement to product owner; it will

be decomposed into small chunks of requirements and they will be considered into different SPRINTs [a set of Small technical requirements, where these can be fixed or enhanced in few hours; ex: include or update a formula] and will be presented for verification.

When the DevOps practices are getting implemented; these SPRINTs can be considered to deploy into different technical environments for validating the build and in turn they will be qualified to move into production. This  is an ongoing process by following Continuous Delivery integration [CDI] of Agile. If many developers are there in a Business unit there can be many builds and the users do not need to wait for all of them to complete. The CD can happen. So whichever is completed first it should be delivered. During the CDI the DevOps engineers role is to package the software code and deploy the builds for verification and later on to production. In their activity journey  many tasks can be repeatable. This repeatable activity can be automated with the So called DevOps tools to save manual efforts. This can reduce the deployment cycle time and at the same time total SPRINT delivery time reduction can happen. So the business benefit can be achieved, by pushing the build of specific user requirement faster.

With all the above, without having Agile practices, you can not jump into DevOps practices right away. The people practices on Agile is also very essential.

So if your organization is not having Agile practices in place there is no point of thinking DevOps practices. This can come under old IT tradition.

Look into the below videos on the importance and advantages of DevOps conversion to an IT Company:

 

Below image can denote the transition of IT development cycles till DevOps practice with continuous operation [automated]:

 

DevOps Movement

 

Visit for next series of DevOps FAQs: https://wordpress.com/post/vskumar.blog/1684

Visit for series of Agile interview questions:

https://vskumar.blog/2017/09/04/sdlc-agile-interview-questions-for-freshers-1/

 

Also, Look into some more FAQs:

https://vskumar.blog/2018/12/29/devops-practices-faqs-2-devops-practices-faqs/

https://vskumar.blog/2019/02/01/devops-practices-faqs-3-domain-area/