User Tools

Site Tools



How to install and test Docker and friends on current Fedora 29.


  • curl -fsSL -o

Get rid of earlier Docker/container content

Fedora's Docker packaging has undergone some reorganization, so you first need to get rid of all earlier Docker-related packages. First, take a quick look at what Docker-related packages are already installed:

$ rpm -qa "*docker*"

If you see older packages, then remove them before going any further:

$ sudo dnf remove \
    docker \
    docker-client \
    docker-client-latest \
    docker-common \
    docker-latest \
    docker-latest-logrotate \
    docker-logrotate \
    docker-selinux \
    docker-engine-selinux \

or possibly just:

$ sudo dnf remove "*docker*"

Registering the Docker repository

The easiest way to install the new Docker packages for Fedora is to register the Docker repository containing those packages. First, install the DNF plugin to manage repositories from the command line:

$ sudo dnf install dnf-plugins-core

Next, register the Docker repository by running:

$ sudo dnf config-manager \
    --add-repo \

To verify that this worked, query that repo -- you should see something like this:

$ dnf repoquery --repo=docker-ce-stable

Installing Docker and Docker Compose

At this point, you can install Docker (and Docker Compose if you wish):

$ sudo dnf install docker-ce [docker-compose]

resulting in:

Installing:         x86_64         1.2.2-3.fc29              docker-ce-stable
     replacing  runc.x86_64
 docker-ce             x86_64         3:18.09.1-3.fc29          docker-ce-stable
Installing dependencies:
 docker-ce-cli         x86_64         1:18.09.1-3.fc29          docker-ce-stable
 libcgroup             x86_64         0.41-20.fc29              fedora

Should create group docker.

Docker RPM scripts


if [ $1 -gt 0 ] ; then
    # package upgrade scenario, before new files are installed

    # clear any old state
    rm -f /var/lib/rpm-state/docker-is-active > /dev/null 2>&1 || :

    # check if docker service is running
    if systemctl is-active docker > /dev/null 2>&1; then
        systemctl stop docker > /dev/null 2>&1 || :
        touch /var/lib/rpm-state/docker-is-active > /dev/null 2>&1 || :


if [ $1 -eq 1 ] ; then 
        # Initial installation 
        systemctl --no-reload preset docker &>/dev/null || : 

if ! getent group docker > /dev/null; then
    groupadd --system docker
... EE stuff snipped ...


if [ $1 -eq 0 ] ; then
        # Package removal, not upgrade
        systemctl --no-reload disable --now docker &>/dev/null || :

update-alternatives --remove dockerd /usr/bin/dockerd || true


if [ $1 -ge 1 ] ; then
        # Package upgrade, not uninstall
        systemctl try-restart docker &>/dev/null || :

Starting Docker

$ systemctl status docker.service
● docker.service - Docker Application Container Engine
   Loaded: loaded (/usr/lib/systemd/system/docker.service; disabled; vendor preset: disabled)
   Active: inactive (dead)
$ sudo systemctl enable docker
$ sudo systemctl start docker

and verify that it's running with:

$ systemctl status docker
● docker.service - Docker Application Container Engine
   Loaded: loaded (/usr/lib/systemd/system/docker.service; enabled; vendor preset: disabled)
   Active: active (running) since Thu 2019-01-24 05:45:18 EST; 6s ago
 Main PID: 16470 (dockerd)
    Tasks: 46
   Memory: 58.3M
   CGroup: /system.slice/docker.service
           ├─16470 /usr/bin/dockerd -H fd://
           └─16496 containerd --config /var/run/docker/containerd/containerd.toml --log-level info

Testing installation

$ sudo docker run hello-world
Unable to find image 'hello-world:latest' locally
latest: Pulling from library/hello-world
1b930d010525: Pull complete 
Digest: sha256:2557e3c07ed1e38f26e389462d03ed943586f744621577a99efb77324b0fe535
Status: Downloaded newer image for 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 ID:

For more examples and ideas, visit:

Running Docker as a non-root user

The installation of docker-ce should have created a new group named docker, and if you want to run Docker images without the constant need for sudo, simply add your username to that group:

$ sudo usermod -aG docker your-username

then log out and log in again, and verify that you're a member of the docker group with:

$ id
uid=1000(rpjday) gid=1000(rpjday) groups=1000(rpjday),967(docker) ...

At this point, you should be able to run the Hello, World image without root privilege:

$ docker run hello-world
... etc etc ...

Running Ubuntu bash

$ docker run -it ubuntu bash
Unable to find image 'ubuntu:latest' locally
latest: Pulling from library/ubuntu
38e2e6cd5626: Pull complete 
705054bc3f5b: Pull complete 
c7051e069564: Pull complete 
7308e914506c: Pull complete 
Digest: sha256:945039273a7b927869a07b375dc3148de16865de44dec8398672977e050a072e
Status: Downloaded newer image for ubuntu:latest
root@f7c76c6f0ee4:/# id
uid=0(root) gid=0(root) groups=0(root)

From another session:

# docker ps
CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS              PORTS               NAMES
f7c76c6f0ee4        ubuntu              "bash"              25 seconds ago      Up 22 seconds                           nifty_spence
docker_installation_on_fedora.txt · Last modified: 2019/01/24 14:01 by rpjday