Installazione di Docker CE

Per impostazione predefinita, Fedora CoreOS offre supporto immediato per il CLI di docker (fornito tramite Moby). Tuttavia, in alcuni casi, la Docker Community Edition (CE) potrebbe essere preferita per vari motivi. Questa pagina spiega come sostituire la versione fornita con l’ultima versione dai sorgenti Docker upstream.

L’approccio raccomandato dalla [documentazione ufficiale di Docker](https://docs.docker.com/engine/install/fedora/) è aggiungere il repository Docker al tuo sistema. In questo modo, puoi installare e aggiornare Docker CE da questo repository.

Installazione di Docker CE al primo avvio

Durante il provisioning, puoi installare Docker CE al primo avvio del sistema tramite la configurazione Ignition.

Example Butane config for setting up Docker CE
variant: fcos
version: 1.6.0
systemd:
  units:
    # Install Docker CE
    - name: rpm-ostree-install-docker-ce.service
      enabled: true
      contents: |
        [Unit]
        Description=Install Docker CE
        Wants=network-online.target
        After=network-online.target
        Before=zincati.service
        ConditionPathExists=!/var/lib/%N.stamp

        [Service]
        Type=oneshot
        RemainAfterExit=yes
        ExecStart=/usr/bin/curl --output-dir "/etc/yum.repos.d" --remote-name https://download.docker.com/linux/fedora/docker-ce.repo
        ExecStart=/usr/bin/rpm-ostree override remove moby-engine containerd runc docker-cli --install docker-ce
        ExecStart=/usr/bin/touch /var/lib/%N.stamp
        ExecStart=/usr/bin/systemctl --no-block reboot

        [Install]
        WantedBy=multi-user.target

Installing Docker CE on a running system

First, download and setup the Docker repository. Then you need to remove moby-engine and several other conflicting packages that ship by default in the Fedora CoreOS image, install the necessary Docker CE packages, and reboot the system.

# Scarica il file del repository Docker per Fedora
curl --remote-name https://download.docker.com/linux/fedora/docker-ce.repo
# Installa il file del repository nella directory appropriata con permessi corretti
sud

Upgrading Docker CE

Docker CE should be upgraded automatically with each new release of Fedora CoreOS.

If you have Docker CE installed and are still using Fedora CoreOS 40, upgrading to Fedora CoreOS 41 will likely fail. This is due to the new docker-cli package added in Fedora CoreOS 41 and later. To upgrade to Fedora CoreOS 41 you’ll need to reset the overrides and uninstall layered Docker CE packages with the following command.

sudo rpm-ostree override reset containerd moby-engine runc --uninstall docker-ce

After upgrading to Fedora CoreOS 41, you can follow the instructions for Installing Docker CE on a running system.