How to install Docker on Fedora 22

Installing Docker - Docker Logo
Installing Docker – Docker Logo

Docker is a container virtualization technology that has gained widespread popularity in recent times, it offers more efficient way to deploy the application. With Docker, the applications resides inside the container on top of the Linux operating system. Docker uses Kernel features such as cgroups and namespace to allow independent container to run on single os instance.

In this post, you will learn how to install Docker on Fedora 22

Note: Docker runs only on 64 bit operating system.

Installing Docker:

Docker is available in standard repository, install it using following command.

# dnf -y install docker

Now you have Docker installed onto your machine, start the Docker service incase if it not started automatically after the installation

# systemctl start docker.service

# systemctl enable docker.service

Run a docker container.

# docker run -it fedora echo Hello-World

Lets see what happens when we run “docker run” command. Docker starts a container with Fedora base image, since we are running this Fedoa container for first time, the output will look like below.

Unable to find image 'fedora:latest' locally
latest: Pulling from docker.io/fedora
48ecf305d2cf: Pull complete
ded7cd95e059: Already exists
docker.io/fedora:latest: The image you are pulling has been verified. Important: image verification is a tech preview feature and should not be relied on to provide security.
Digest: sha256:10ba981a70632d7764c21deae25c6521db6d39730e1dd8caff90719013858a7b
Status: Downloaded newer image for docker.io/fedora:latest
Hello-World

Docker looks for fedora image locally, and it is not found, it starts downloading the image from docker registry. Once the images has been downloaded, it will start the container and echo the command “Hello-World” in the console which you can see at the end of the output.

Allowing Non-root access:

As you can see in my command, for Fedora i had to run docker as root user. To avoid this you can follow below procedure to allow non-root users to run Docker containers.

Create a group called docker, run the following commands with root privileges.

# groupadd docker

Add a user that is to be a part of docker group, replace “raj” with your own user name.

# useradd raj

Add a user to docker group.

# usermod -aG docker raj

Change the permission.

# chown root:docker /var/run/docker.sock

Now you can run a Docker with non-root user. That’s All!, You can now start working with Docker.

Links:

Fedora: http://fedoraproject.org/

Docker : https://docs.docker.com/installation/fedora/

Docker Registry : http://registry.hub.docker.com/

POSTS YOU MAY LIKE -:)

Share This Post

Shares