In this short tutorial we will learn how to install Docker on Fedora 38 operating system. At least there are two options to install Docker, namely using OS repository and using source file.
Introduction
In the fast-paced world of software development, efficiency and scalability are paramount. Docker, a revolutionary containerization platform, has emerged as a game-changer, allowing developers to streamline their workflows, enhance collaboration, and deploy applications seamlessly across various environments. In this article, we’ll delve into the world of Docker, exploring its key features, benefits, and providing practical insights for beginners.
What is Docker?
Docker is an open-source platform that automates the deployment of applications inside lightweight, portable containers. These containers encapsulate all the dependencies and configurations needed to run an application, ensuring consistency across different environments.
Key Concepts
- Containers: Lightweight, standalone, executable packages that include everything needed to run a piece of software.
- Images: Snapshots of a container, containing the application and its dependencies.
- Dockerfile: A script defining the steps to create a Docker image.
Advantages of Docker
- Portability. Docker containers run consistently across different environments, eliminating the common “it works on my machine” problem. This portability enhances collaboration and accelerates development.
- Efficiency. Docker’s lightweight nature ensures optimal resource utilization, allowing for the deployment of more applications on the same hardware than traditional virtualization methods.
- Scalability. Docker’s ability to scale applications effortlessly makes it a favorite among developers. Whether you’re handling a small project or a large-scale application, Docker’s scalability is unmatched.
How To Install Docker On Fedora 38
There are two methods of installing Docker, namely: using the Docker repository, installing from the rpm package. However, before the installation process can begin, there are prerequisites that must be met, namely: OS Fedora 38 and no Docker packages installed on the system.
Installing Docker using the RPM Repository
Installing Docker using RPM repository, we need to set up the Docker repository. Then can install and update Docker from the repository. For this purpose we will do following steps :
1. Set up the Repository
To setup Docker repository, we wil use the following command line :
$ sudo dnf -y install dnf-plugins-core $ sudo dnf config-manager --add-repo https://download.docker.com/linux/fedora/docker-ce.repo
Output :
ramansah@bckinfo ~]$ sudo dnf -y install dnf-plugins-core Fedora 38 - x86_64 386 kB/s | 83 MB 03:39 Fedora 38 openh264 (From Cisco) - x86_64 419 B/s | 2.5 kB 00:06 Fedora Modular 38 - x86_64 644 kB/s | 2.8 MB 00:04 Fedora 38 - x86_64 - Updates 124 kB/s | 35 MB 04:46 Fedora Modular 38 - x86_64 - Updates 171 kB/s | 2.1 MB 00:12 Package dnf-plugins-core-4.4.0-1.fc38.noarch is already installed. Dependencies resolved. Nothing to do. Complete!
ramansah@bckinfo ~]$ sudo dnf config-manager --add-repo https://download.docker.com/linux/fedora/docker-ce.repo [sudo] password for ramansah: Adding repo from: https://download.docker.com/linux/fedora/docker-ce.repo
1. Install Docker
In this stage, we will install Docker Engine, containerd, and Docker Compose. We will execute the following command lines :
$ sudo dnf update $ sudo dnf install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
Output :
[ramansah@bckinfo ~]$ sudo dnf install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin Docker CE Stable - x86_64 31 kB/s | 15 kB 00:00 Dependencies resolved. ========================================================================================================================= Package Architecture Version Repository Size ========================================================================================================================= Installing: containerd.io x86_64 1.6.24-3.1.fc38 docker-ce-stable 33 M docker-buildx-plugin x86_64 0.11.2-1.fc38 docker-ce-stable 13 M docker-ce x86_64 3:24.0.7-1.fc38 docker-ce-stable 24 M docker-ce-cli x86_64 1:24.0.7-1.fc38 docker-ce-stable 7.1 M docker-compose-plugin x86_64 2.21.0-1.fc38 docker-ce-stable 13 M Installing dependencies: container-selinux noarch 2:2.209.0-1.fc38 fedora 51 k libcgroup x86_64 3.0-2.fc38 fedora 75 k Installing weak dependencies: docker-ce-rootless-extras x86_64 24.0.7-1.fc38 docker-ce-stable 3.9 M Transaction Summary ========================================================================================================================= Install 8 Packages Total download size: 93 M Installed size: 367 M Is this ok [y/N]: y . . . Installed: container-selinux-2:2.209.0-1.fc38.noarch containerd.io-1.6.24-3.1.fc38.x86_64 docker-buildx-plugin-0.11.2-1.fc38.x86_64 docker-ce-3:24.0.7-1.fc38.x86_64 docker-ce-cli-1:24.0.7-1.fc38.x86_64 docker-ce-rootless-extras-24.0.7-1.fc38.x86_64 docker-compose-plugin-2.21.0-1.fc38.x86_64 libcgroup-3.0-2.fc38.x86_64 Complete!
2. Starting Docker
After Docker installation was completed done the Docker daemon will be started. We will submit command lines :
$ sudo systemctl start docker $ sudo systemctl status docker
Output :
[ramansah@bckinfo ~]$ sudo systemctl start docker [ramansah@bckinfo ~]$ sudo systemctl status docker ● docker.service - Docker Application Container Engine Loaded: loaded (/usr/lib/systemd/system/docker.service; disabled; preset: disabled) Drop-In: /usr/lib/systemd/system/service.d └─10-timeout-abort.conf Active: active (running) since Sat 2023-11-18 00:35:51 WIB; 7s ago TriggeredBy: ● docker.socket Docs: https://docs.docker.com Main PID: 4901 (dockerd) Tasks: 9 Memory: 165.5M CPU: 328ms CGroup: /system.slice/docker.service └─4901 /usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock Nov 18 00:35:49 bckinfo systemd[1]: Starting docker.service - Docker Application Container Engine... Nov 18 00:35:50 bckinfo dockerd[4901]: time="2023-11-18T00:35:50.140825573+07:00" level=info msg="Starting up" Nov 18 00:35:50 bckinfo dockerd[4901]: time="2023-11-18T00:35:50.143391730+07:00" level=info msg="detected 127.0.0.53 na> Nov 18 00:35:50 bckinfo dockerd[4901]: time="2023-11-18T00:35:50.226941014+07:00" level=info msg="Loading containers: st> Nov 18 00:35:51 bckinfo dockerd[4901]: time="2023-11-18T00:35:51.098483042+07:00" level=info msg="Firewalld: interface d> Nov 18 00:35:51 bckinfo dockerd[4901]: time="2023-11-18T00:35:51.226257347+07:00" level=info msg="Loading containers: do> Nov 18 00:35:51 bckinfo dockerd[4901]: time="2023-11-18T00:35:51.301118652+07:00" level=info msg="Docker daemon" commit=> Nov 18 00:35:51 bckinfo dockerd[4901]: time="2023-11-18T00:35:51.301401042+07:00" level=info msg="Daemon has completed i> Nov 18 00:35:51 bckinfo dockerd[4901]: time="2023-11-18T00:35:51.500583051+07:00" level=info msg="API listen on /run/doc> Nov 18 00:35:51 bckinfo systemd[1]: Started docker.service - Docker Application Container Engine.
3. Verify Docker Installation
After Docker installation is completed done, then we will verify itu by submitting a command to download a test image and runs it in a container. When the container runs, it prints a confirmation message and exits.
$ sudo docker run hello-world
Output :
[ramansah@bckinfo ~]$ sudo docker run hello-world Unable to find image 'hello-world:latest' locally latest: Pulling from library/hello-world 719385e32844: Pull complete Digest: sha256:c79d06dfdfd3d3eb04cafd0dc2bacab0992ebc243e083cabe208bac4dd7759e0 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. (amd64) 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: https://hub.docker.com/ For more examples and ideas, visit: https://docs.docker.com/get-started/
We have now successfully installed and started Docker Engine on Fedora 38 operating system.
Conclusion
In this short tutorial, we have learned how to install Docker on Fedora 38.