Install docker engine on Fedora 33

This guide is for home/hobby users. There is settings here not optimal for a production environment.

Add kernel parameter to enable cgroup v1

edit /etc/default/grub
GRUB_CMDLINE_LINUX="systemd.unified_cgroup_hierarchy=0"

Turn off mitigations kernel parameter (optional:performance over security)

edit /etc/default/grub
GRUB_CMDLINE_LINUX="mitigations=off"

Update grub.cfg

grub2-mkconfig -o `find /boot -name "grub.cfg"`

Change firewalld backend to iptables

sed -i '/FirewallBackend=/s/.*/FirewallBackend=iptables/' /etc/firewalld/firewalld.conf

Change selinux to permissive (optional)

sed -i '/^SELINUX=/s/.*/SELINUX=permissive/' /etc/selinux/config

Install docker

dnf install moby-engine docker-compose -y

Enable docker (Need restart before start - cgroup parameter)

systemctl enable docker

Reboot to enable new kernel parameters and firewall

systemctl reboot

Or you can use this Ansible playbook to install Docker engine on Fedora 33

---
- hosts: localhost
  tasks:
  - name: Revert to cgroup1
    lineinfile:
      state: present
      dest: /etc/default/grub
      backrefs: yes
      regexp: '^(GRUB_CMDLINE_LINUX=(?!.* systemd.unified_cgroup_hierarchy)\"[^\"]+)(\".*)'
      line: '\1 systemd.unified_cgroup_hierarchy=0\2'
    register: cgroup1

  - name: Find grub.cfg
    command: 'find /boot -name grub.cfg'
    register: grubfile
    when: cgroup1.changed
    
  - name: Update grub.cfg
    command: 'grub2-mkconfig -o {{ grubfile.stdout }}'
    when: cgroup1.changed

  - name: Revert to iptable for firewalld backend
    lineinfile:
      state: present
      dest: /etc/firewalld/firewalld.conf
      regexp: '^FirewallBackend='
      line: 'FirewallBackend=iptables'
    register: iptablebackend

  - name: Change selinux to permissive
    lineinfile:
      state: present
      dest: /etc/selinux/config
      regexp: '^SELINUX='
      line: 'SELINUX=disabled'

  - name: Install docker engine
    dnf: 
      name:
        - moby-engine
        - docker-compose
      state: latest

  - name: Enable docker engine
    systemd:
      name: docker.service
      enabled: yes

  - name: Reboot host
    command: /usr/bin/systemctl reboot
    when: cgroup1.changed or iptablebackend.changed

This playbook will install Docker engine in Fedora 33. Run it as Ansible playbook. You can easily run it directly from my git:

ansible-pull -U https://gitlab.fredhs.net/snippets/1.git

You need to have ansible and git-core installed to run this command.