Sujeeth – Docker LAB

Limited Time Offer!

For Less Than the Cost of a Starbucks Coffee, Access All DevOpsSchool Videos on YouTube Unlimitedly.
Master DevOps, SRE, DevSecOps Skills!

Enroll Now

Install Docker Engine in Centos#1 Vm.

[root@localhost ~]#
1 clear 
2 sudo yum install -y yum-utils device-mapper-persistent-data lvm2 
3 sudo yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo 
4 sudo yum install –y https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm 
5 sudo yum-config-manager --enable rhui-REGION-rhel-server-extras 
6 sudo yum install -y docker-ce

Verification :

[root@[root@localhost ~]# cd
[root@localhost ~]# which dockerd
/bin/dockerd
[root@localhost ~]# which docker
/bin/docker
[root@localhost ~]# ps -eaf | grep dockerd
root 951 1 0 03:32 ? 00:00:01 /usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock
root 1783 1759 0 05:00 pts/1 00:00:00 grep --color=auto dockerd
[root@localhost ~]# which containerd
/bin/containerd
[root@localhost ~]# ps -eaf | grep containerd
root 862 1 0 03:32 ? 00:00:06 /usr/bin/containerd
root 951 1 0 03:32 ? 00:00:01 /usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock
root 1787 1759 0 05:00 pts/1 00:00:00 grep --color=auto containerd

Assignment #1

[root@localhost ~]# docker run -itd ubuntu
17a7c76b24ad74f3924d683cf9533e041b9bb443d4b8272d86cc13aa98e5a112
[root@localhost ~]#
[root@localhost ~]#
[root@localhost ~]#
[root@localhost ~]#
[root@localhost ~]# docker ps -a
CONTAINER ID   IMAGE     COMMAND   CREATED          STATUS          PORTS     NAMES
17a7c76b24ad   ubuntu    "bash"    14 seconds ago   Up 13 seconds             heuristic_hofstadter


[root@localhost ~]# docker attach 17a7c76b24ad


root@17a7c76b24ad:/# apt update
Get:1 http://archive.ubuntu.com/ubuntu focal InRelease [265 kB]
Get:2 http://security.ubuntu.com/ubuntu focal-security InRelease [114 kB]
Get:3 http://archive.ubuntu.com/ubuntu focal-updates InRelease [114 kB]
Get:4 http://archive.ubuntu.com/ubuntu focal-backports InRelease [101 kB]


root@17a7c76b24ad:/# apt install git
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following additional packages will be installed:
  ca-certificates git-man krb5-locales less libasn1-8-heimdal libbrotli1 libbsd0 libcbor0.6 libcurl3-gnutls libedit2 liberror-perl libexpat1 libfido2-1
  libgdbm-compat4 libgdbm6 libgssapi-krb5-2 libgssapi3-heimdal libhcrypto4-heimdal libheimbase1-heimdal libheimntlm0-heimdal libhx509-5-heimdal libk5crypto3
  libkeyutils1 libkrb5-26-heimdal libkrb5-3 libkrb5support0 libldap-2.4-2 libldap-common libnghttp2-14 libperl5.30 libpsl5 libroken18-heimdal librtmp1 libsasl2-2
  libsasl2-modules libsasl2-modules-db libsqlite3-0 libssh-4 libssl1.1 libwind0-heimdal libx11-6 libx11-data libxau6 libxcb1 libxdmcp6 libxext6 libxmuu1 netbase
  openssh-client openssl patch perl perl-modules-5.30 publicsuffix xauth


root@17a7c76b24ad:/# git version
git version 2.25.1



root@17a7c76b24ad:/# apt-get install apache2
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following additional packages will be installed:
  apache2-bin apache2-data apache2-utils file libapr1 libaprutil1 libaprutil1-dbd-sqlite3 libaprutil1-ldap libcurl4 libicu66 libjansson4 liblua5.2-0 libmagic-mgc
  libmagic1 libxml2 mime-support ssl-cert tzdata xz-utils
Suggested packages:
  apache2-doc apache2-suexec-pristine | apache2-suexec-custom www-browser ufw openssl-blacklist
The following NEW packages will be installed:
  apache2 apache2-bin apache2-data apache2-utils file libapr1 libaprutil1 libaprutil1-dbd-sqlite3 libaprutil1-ldap libcurl4 libicu66 libjansson4 liblua5.2-0
  libmagic-mgc libmagic1 libxml2 mime-support ssl-cert tzdata xz-utils
0 upgraded, 20 newly installed, 0 to remove and 2 not upgraded.
Need to get 12.0 MB of archives.
After this operation, 55.0 MB of additional disk space will be used.
Do you want to continue? [Y/n] y



you need to run this command to exit from ubuntu 
cntrl + p + q with bash

Assignment #2

[root@localhost ~]# docker run -d -p 80:80 httpd
718eeba69e12856953fdd80505eebcea35371849139eb6261bf4957d3e4a8edc
[root@localhost ~]#
[root@localhost ~]#
[root@localhost ~]# docker run -d -p 8080:80 --name webserver httpd
fb24cf429c0bd653f2c7547dc9ef0f6eb7c6e960593171e97886c6cde9f1b3d2
[root@localhost ~]#