Getting Started with Docker


Hello,

In this article I’ll show you how to install docker on a CentOS7 machine and make it ready for your future docking deployments. If you are not familiar with containers you should know that this technology allows you to create multiple user space instances on a Linux machine. Simply put, you can run multiple applications that have their own environment in terms of processes, user space and file system (hence the “container” name). Each container is isolated from others. The only thing that’s shared between containers is the Linux kernel since containers run on top of the OS. Containers have a lower resource footprint than Virtual Machines since multiple containers can run on a single server. By comparison, with VMs you need to spawn multiple servers that have their own Operating System on top of which you run applications. Since each container is isolated you can run multiple applications that listen on the same port on a single server.

To install docker on  CentOS7 run the yum install docker command:

docker

how to install docker

You can verify the status of the docker service by typing systemctl status docker.service:

docker

verify docker service status

As you can see, the docker service is stopped right now so we need to start it by typing systemctl start docker.service. You can then verify again the status of the service to make sure it has successfully started:

docker-service

docker on centos7

What’s left to do is to enable the automatic startup of the docker service. To achieve this result use the systemctl enable docker command:

docker-status

how to enable docker service

As you can see form the image, a symlink is created from the multi-user.target.wants directory to the location of the docker service. Because our machine will run by default in multi-user mode, the docker service is added to this location. You can verify the default target by typing systemctl get-default or by checking the contents of the /etc/systemd/system/default.target file:

default-target

system default target

Now execute docker run hello-world to make sure that the installation has been completed successfully:

docker-hello

how to run docker containers

To view system-wide docker information type docker info. You can also verify docker version with the docker version command:

docker-version

how to verify docker version

That’s about it for this first docker article, once you have everything installed and configured, you can proceed further with docker containers and images. Stay tuned for the following articles from IT training day.

Advertisements

Leave a Reply

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

WordPress.com Logo

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

Twitter picture

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

Facebook photo

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

Google+ photo

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

Connecting to %s