How To Install Docker on Fedora 38
In this tutorial, we will show you how to install Docker on Fedora 38. Are you a software developer looking to streamline your development process? With Docker, you can streamline your development and deployment processes, making it easier to share your code and collaborate with your team. Plus, Docker’s lightweight nature and portability make it an ideal choice for scaling applications quickly and efficiently.
This article assumes you have at least basic knowledge of Linux, know how to use the shell, and most importantly, you host your site on your own VPS. The installation is quite simple and assumes you are running in the root account, if not you may need to add ‘sudo
‘ to the commands to get root privileges. I will show you the step-by-step installation of Docker Community Edition on a Fedora 38.
Prerequisites
- A server running one of the following operating systems: Fedora 38.
- It’s recommended that you use a fresh OS install to prevent any potential issues.
- SSH access to the server (or just open Terminal if you’re on a desktop).
- An active internet connection. You’ll need an internet connection to download the necessary packages and dependencies for Docker.
- Docker supports multiple architectures, including x86_64 (commonly known as 64-bit) and ARM64. Verify that your system meets the required architecture specifications.
- A
non-root sudo user
or access to theroot user
. We recommend acting as anon-root sudo user
, however, as you can harm your system if you’re not careful when acting as the root.
Install Docker on Fedora 38
Step 1. Before we can install Docker on Fedora 38, it’s important to ensure that our system is up-to-date with the latest packages. This will ensure that we have access to the latest features and bug fixes and that we can install Docker without any issues:
sudo dnf upgrade --refresh sudo dnf install dnf-plugins-core
Step 2. Installing Docker on Fedora 38.
Now we add the Docker repository to your Fedora 38 system. To do so, run the following commands:
sudo dnf config-manager --add-repo https://download.docker.com/linux/fedora/docker-ce.repo sudo rpm --import https://download.docker.com/linux/fedora/gpg
With the Docker repository added to your system, you can now install Docker itself. To do so, run the following command:
sudo dnf install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
Once Docker is installed, you’ll need to start and enable its service. To do so, run the following commands:
sudo systemctl start docker sudo systemctl enable docker
To verify that Docker is installed correctly on Fedora 38, run the following command:
sudo docker run hello-world
If everything is set up correctly, we should get a message saying “Hello from Docker!” along with some additional text. This means that Docker has been installed successfully on our Fedora 38 system.
Step 4. Docker Commands.
Docker has many commands that allow you to manage containers, images, and volumes. Here are some common Docker commands:
Command | Description | Example |
---|---|---|
docker run | Create and start a container | docker run -it ubuntu:20.04 /bin/bash |
docker ps | List running containers | docker ps |
docker images | List available images | docker images |
docker pull | Download an image from Docker Hub | docker pull nginx |
docker build | Build an image from a Dockerfile | docker build -t myimage . |
docker stop | Stop a running container | docker stop mycontainer |
docker rm | Remove a container | docker rm mycontainer |
docker rmi | Remove an image | docker rmi myimage |
docker exec | Execute a command inside a running container | docker exec mycontainer ls |
docker logs | Show logs for a container | docker logs mycontainer |
docker-compose up | Create and start containers based on the configuration in a docker-compose.yml file | docker-compose up |
docker-compose down | Stop and remove containers created by ‘docker-compose up’ command | docker-compose down |
docker-compose build | Build or rebuild services defined in a docker-compose.yml file | docker-compose build |
docker-compose ps | List containers created by ‘docker-compose up’ command | docker-compose ps |
docker-compose logs | Show logs for containers created by ‘docker-compose up’ command | docker-compose logs myservice |
docker-compose restart | Restart containers created by ‘docker-compose up’ command | docker-compose restart myservice |
docker-compose stop | Stop containers created by ‘docker-compose up’ command | docker-compose stop myservice |
Congratulations! You have successfully installed Docker. Thanks for using this tutorial for installing Docker Community Edition on your Fedora 38 system. For additional help or useful information, we recommend you check the official Docker website.