Docker is container-based application framework, which wrap of a specific application with all its dependencies in a container. Docker containers can easily ship to a remote location on start there without making the entire application setup.
This tutorial will help you to install Docker on Fedora Linux systems.
For the standard installation, Docker required a 64-bit operating system having Kernel >= 3.10 version. Older versions of Kernel have some missing requirements to run all features of Docker.
Step 1 – Enable DNF Repository
Let’s add the official Docker yum repository to your system. Also, update the package’s metadata cache.
sudo dnf config-manager --add-repo https://download.docker.com/linux/fedora/docker-ce.repo
sudo dnf makecache
Step 2 – Install Docker on Fedora
Now 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
After successful installation of the Docker engine, Let’s enable and start the docker service.
sudo systemctl enable docker.service
sudo systemctl start docker.service
Then check the status of the Docker service.
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 above images have been downloaded successfully on your system. 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. 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
You can start, stop or attach to any containers with the following commands. To start the container use 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