How to commit docker images


[cloud_user@aryan1c ~]$ docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES

To commit docker image, you need to copy the identification number
65d264fc1d7e centos:6 “/bin/bash” 39 minutes ago Exited (0) About a minute ago quirky_nightingale
5fdeaceec288 spacebones/doge “nginx -g ‘daemon …” 2 hours ago Up 2 hours 0.0.0.0:80->80/tcp treatseekers
[cloud_user@aryan1c ~]$ docker commit 65d264fc1d7e spacebones:thewebsite
sha256:d764a58ff47b2db18aec6aa2928b404998130cdba8edcaa6af78ea5f744b651f
[cloud_user@aryan1c ~]$ docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
spacebones thewebsite d764a58ff47b 4 seconds ago 511 MB

Apache2 Ubuntu Default Page shows instead of my actual website


To avoid this to happen
mv /etc/httpd/conf.d/welcome.conf /etc/httpd/conf.d/welcome.bak

apache

chkconfig httpd on

How to copy contents to web server directory in Linux


To copy contents to Apache Web Server Directory, Use CP

cp YOURCONTENT/FOLDER/* /var/www/html/

Example:

[root@65d264fc1d7e /]# cp content-dockerquest/mydocker/* /var/www/html/

How to install Apache in Linux container


[root@65d264fc1d7e /]# yum -y install httpd
Loaded plugins: fastestmirror, ovl
Setting up Install Process
Loading mirror speeds from cached hostfile
* base: mirror.cisp.com
* extras: mirrors.mit.edu
* updates: mirror.trouble-free.net
Resolving Dependencies
–> Running transaction check
—> Package httpd.x86_64 0:2.2.15-69.el6.centos will be installed
–> Processing Dependency: httpd-tools = 2.2.15-69.el6.centos for package: httpd-2.2.15-69.el6.centos.x86_64
–> Processing Dependency: apr-util-ldap for package: httpd-2.2.15-69.el6.centos.x86_64

docker pull


How to download docker images and access the images
In this case, I am pulling Centos6 Image from Docker and accessing it using docker run -it centos:6 /bin/bash and updating my image

[cloud_user@aryan1c ~]$ docker pull centos:6
Trying to pull repository docker.io/library/centos …
6: Pulling from docker.io/library/centos
ff50d722b382: Pull complete
Digest: sha256:dec8f471302de43f4cfcf82f56d99a5227b5ea1aa6d02fa56344986e1f4610e7
Status: Downloaded newer image for docker.io/centos:6
[cloud_user@aryan1c ~]$ docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
docker.io/centos 6 d0957ffdf8a2 2 months ago 194 MB

[cloud_user@aryan1c ~]$ docker run -it centos:6 /bin/bash
[root@65d264fc1d7e /]# ls
bin dev etc home lib lib64 lost+found media mnt opt proc root run sbin selinux srv sys tmp usr var
[root@65d264fc1d7e /]# yum update