Docker is a container-based virtualization platform that has revolutionized the way developers build, deploy, and manage applications. It simplifies the process of creating, deploying, and managing containers on multiple operating systems. In this article, we will discuss how to install and use Docker on Fedora, one of the most popular Linux desktop distributions.

Advertisement

Installing Docker on Fedora

The Docker team provides an official repository containing the Docker engine RPM packages. You just need to configure the RPM repository on your system to install the Docker engine.

  1. Remove all the existing installed Docker packages from your system. The following command will help you to remove older Docker packages from your system:
    sudo dnf remove docker docker-client docker-latest docker-common docker-client-latest docker-latest-logrotate docker-logrotate docker-engine 
    
  2. Next, install the dnf-utils package that provides dnf-config-manager command line utility:
    sudo dnf install dnf-utils 
    
  3. Add the official Docker rpm repository with the following command:
    sudo dnf-config-manager --add-repo https://download.docker.com/linux/fedora/docker-ce.repo 
    
  4. Finally, install the docker community edition package to install docker on your system. This is installed in many of the required decencies on your system.
    sudo dnf install docker-ce docker-ce-cli containerd.io 
    
  5. After the successful installation of the Docker engine, Let’s enable and start the docker service. Also, enable the containerd service.
    sudo systemctl enable docker.service 
    sudo systemctl start docker.service 
    sudo systemctl enable containerd.service 
    

    Then check the status of the Docker service.

    How to Install and Use Docker on Fedora
    Running Docker service on Fedora

Docker has been installed and running on your system. You can visit our Docker tutorial section to work with Docker containers.

How to Use Docker?

Search Docker Images

First of all search Docker container images from the Docker hub. For example, the below command will search all images with Fedora and list them as output

sudo docker search fedora 

Download Docker Images

Now download the Docker container with the name Ubuntu on your local system using the following commands.

sudo docker pull fedora 
Output:
Using default tag: latest latest: Pulling from library/fedora 0be2a68855d7: Extracting [==============================> ] 69.63MB/89.87MB

Now make sure that the above images have been downloaded successfully on your system. The below command list all images.

sudo docker images
Output:
REPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZE ubuntu latest 36248ae4a9ac 2 days ago 188 MB fedora latest 26ffec5b4a8a 2 weeks ago 275MB

Launch New Container with Image

Finally, launch a Docker container using the above-downloaded image on your system. The below command will start a new container.

sudo docker run -i -t -d fedora /bin/bash 

To view all running containers type

sudo docker ps 
Output:
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 695efa2ace69 fedora "/bin/bash" 58 seconds ago Up 56 seconds first_fedora

By default Above command will list only running containers. To list all containers (including stopped containers) use the following command.

docker ps -a 

Start/Stop/Attach Container

You can start, stop or attach to any containers with the following commands. To start the container using the following command.

docker start container_id 

To stop a container, type:

sudo docker stop container_id 

To attach to the currently running container use the following command.

sudo docker attach container_id 

Conclusion

In this article, we discussed how to install and use Docker on Fedora, one of the most popular Linux distributions. We discussed the benefits of using Docker, how to install it on fedora, and how to create and manage Docker containers. Finally, we discussed how to ensure the security of your Docker containers.

Share.

4 Comments

  1. Hello,

    I did it on Fedora 30 and got back

    Error:
    Problem: conflicting requests
    – nothing provides libcgroup needed by docker-ce-3:19.03.0-3.fc30.x86_64
    – nothing provides container-selinux >= 2:2.74 needed by docker-ce-3:19.03.0-3.fc30.x86_64
    – nothing provides libcgroup needed by docker-ce-3:19.03.1-3.fc30.x86_64
    – nothing provides container-selinux >= 2:2.74 needed by docker-ce-3:19.03.1-3.fc30.x86_64

    From where do I install the missing containers? DNF update makes nothing, or Yum update

Leave A Reply


Exit mobile version