search
top

How To Install Docker on Fedora 25

Introduction

So what is Docker? According to Docker, Docker containers wrap a piece of software in a complete filesystem that contains everything needed to run: code, runtime, system tools, system libraries – anything that can be installed on a server. This guarantees that the software will always run the same, regardless of its environment.

Docker allows applications to use the same Linux kernel as the system that they’re running on and only requires applications be shipped with things not already running on the host computer. This gives a significant performance boost and reduces the size of the application.

In this post we will cover how to install Docker on Fedora 25 and create an initial Docker container.

Process

For installing the Docker engine we will be using the packages from Fedora’s repository as they are not available from Docker at this time.  Once the packages are available an updated post will be created to show how to install using the packages from Docker.

Next we need to install docker-engine. Current version in the Fedora repository is 1.12.

$ sudo dnf install docker-engine

docker1

Once the installation has completed it is time to enable the docker service to run at startup.

$ sudo systemctl enable docker.service

Now start it up.

$ sudo systemctl start docker.service
Created symlink /etc/systemd/system/multi-user.target.wants/docker.service â /usr/lib/systemd/system/docker.service.

Now that we are running we can test docker by running the hello-world test container.

$ sudo docker run –rm hello-world
Unable to find image ‘hello-world:latest’ locally
Trying to pull repository docker.io/library/hello-world …
sha256:0256e8a36e2070f7bf2d0b0763dbabdd67798512411de4cdcf9431a1feb60fd9: Pulling from docker.io/library/hello-world
c04b14da8d14: Pull complete
Digest: sha256:0256e8a36e2070f7bf2d0b0763dbabdd67798512411de4cdcf9431a1feb60fd9
Status: Downloaded newer image for docker.io/hello-world:latest

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.
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.

To try something more ambitious, you can run an Ubuntu container with:
$ docker run -it ubuntu bash

Share images, automate workflows, and more with a free Docker Hub account:
https://hub.docker.com

For more examples and ideas, visit:
https://docs.docker.com/engine/userguide/

To avoid having to use sudo when you use the docker command, create a group called docker and add users to it. When the docker daemon starts, it makes the ownership of the Unix socket read/writable by the docker group.

Warning: The docker group is equivalent to the root user; For details on how this impacts security in your system, see Docker Daemon Attack Surface for details.
To create the docker group and add your user:

Create the docker group.

$ sudo groupadd docker

Add your user to docker group.

$ sudo usermod -a G docker <user_id>

Log out and log back in.
This ensures your user is running with the correct permissions.
Verify that your user is in the docker group by running docker without sudo.

Uninstall

Just incase you want to remove Docker from your system here is what you need to do.

List the installed Docker packages.
$ sudo dnf list installed | grep docker
docker.x86_64 2:1.12.3-10.git7b5044b.fc25 @updates
docker-common.x86_64 2:1.12.3-10.git7b5044b.fc25 @updates
python-dockerfile-parse.noarch 0.0.5-5.fc25 @@commandline
Remove the package.

$ sudo dnf -y remove docker-engine.x86_64

This command does not remove images, containers, volumes, or user-created configuration files on your host.
To delete all images, containers, and volumes, run the following command:

$ sudo rm -rf /var/lib/docker

Conclusion

There you have it, Docker is running and you can begin to create Docker containers and use them.

2 Responses to “How To Install Docker on Fedora 25”

  1. Sam Sharpe says:

    You are installing the packages from Fedora, not the packages from Docker.

    As far as I can tell, Docker doesn’t publish for F25.

    This is further backed up by the top line of your screenshot which says “Failed to synchronize cache for repo ‘dockerrepo’, disabling.” and the fact that the packages in your screenshot come from the “updates” or “fedora” repository, rather than “dockerrepo”.

    Just leaving this comment as an info for others, as this page was high in Google for “Fedora 25 docker”. FYI, there’s nothing wrong with installing Docker from the Fedora repos, but it’s not what this article promises (and what I was trying to find info about).

    All the best,

    Sam

    • newlife007 says:

      Sam you are correct I have an error in the post and there are no Fedora 25 packages in the Docker Repository so this is installing just from Fedora repository’s my mistake and I have updated the article. I will redo the article once the repos are available or see if there is another way. I do have an update. the Fedora repository is updating, just not at 1.14 release that is currently in development, but it is at the latest for stable.
      docker 2:1.12.5-1.git6009905.fc25
      docker-common 2:1.12.5-1.git6009905.fc25

Leave a Reply

Your email address will not be published. Required fields are marked *

top