Docker installation in Fedora 33

This page is a guide to the installation and configuration of docker in a Linux machine.
It is specifically addressed to Fedora 33 and, because of the use of specific docker for Fedora
repositories, I doubt they may be useful for other distributions. Nevertheless, point 2 on space
affects only the configuration of docker and may be interesting for all.

This has been written by Juan Domingo, University of Valencia. For questions, send me an email to
J1u2a3n4D5o6m7i8n9go#uv.es
getting rid of the numbers and substituting the hash by the @ symbol. Nevertheless, I will not always be able to answer quickly.

The guide assumes basic knowledge of Linux (console use and bash commands) and software management
(use of dnf or your distribution package management system).

These directions are really a summarized version of those given in this page.

From now on, everything should be done with root privileges, so become root (su -) or precede all commands with sudo.

The steps are:
  1. Remove any previous docker installation you may have:
    dnf remove docker docker-client docker-client-latest docker-common docker-latest \
    docker-latest-logrotate docker-logrotate docker-selinux docker-engine-selinux docker-engine
    If some or all of these packages are not installed, dnf will complain, but that's OK.
    Install and activate a new repository:
    dnf -y install dnf-plugins-core
    dnf config-manager --add-repo https://download.docker.com/linux/fedora/docker-ce.repo
    dnf install docker-ce docker-ce-cli containerd.io

  2. Now, this step is optional but extremely recommended. Docker uses TONS of space so it is better to
    put its storage space where you are sure to have room for it.
    As an example, my ShareLaTeX container with all LaTeX packages installed uses 7.78 GB
    In its standard installation, docker images and containers are stored under /var/lib/docker and,
    unless you have /var mounted in a separate partition, there are many chances your root partition get exhausted.
    To avoid that, look for a place in another partition where you have plenty of space, for the sake of example, let it be /d and make:
    mkdir /d/docker
    Then, edit the file /lib/systemd/system/docker.service and change
    ExecStart=/usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock
    by
    ExecStart=/usr/bin/dockerd -g /d/docker -H fd:// --containerd=/run/containerd/containerd.sock
    Since we have changed a script in the disk, we should inform the daemon management system with
    systemctl daemon-reload

  3. Start the docker service with
    systemctl restart docker
    Check that the service has started well with
    systemctl status docker
    and, if not, look at the failures with
    journalctl -xe
    Also, you should check that several folders have been created under /d/docker (or, if you skipped step 2, under /var/lib/docker)
    and also that docker can download images and execute containers with
    docker run hello-world

  4. Finally, if everything is fine, enable the docker service and restart it:
    systemctl enable docker
    systemctl restart docker
If you have come here from my former page on ShareLaTeX installation, go back to it.