Install Docker and Docker Compose on Linux Fedora
Docker is an open platform for developing, shipping, and running applications. Docker enables you to separate your applications from your infrastructure so you can deliver software quickly. With Docker, you can manage your infrastructure in the same ways you manage your applications. By taking advantage of Docker’s methodologies for shipping, testing, and deploying code quickly, you can significantly reduce the delay between writing code and running it in production.
Docker Compose is a tool for defining and running multi-container Docker applications. With Compose, you use a YAML file to configure your application’s services. Then, with a single command, you create and start all the services from your configuration.
Fedora Linux is a Linux distribution developed by the Fedora Project which is sponsored primarily by Red Hat (an IBM subsidiary) with additional support and sponsors from other companies and organizations. Fedora contains software distributed under various free and open-source licenses and aims to be on the leading edge of open-source technologies. Fedora is the upstream source for Red Hat Enterprise Linux.
To get started with Docker Engine on Fedora, make sure you meet the prerequisites, then install Docker.
To install Docker Engine, you need the 64-bit version of one of these Fedora versions:
Install using the repository
Before you install Docker Engine for the first time on a new host machine, you need to set up the Docker repository. Afterward, you can install and update Docker from the repository.
Set up the repository
Install the dnf-plugins-core package (which provides the commands to manage your DNF repositories) and set up the stable repository.
[root@fedora ~]# sudo dnf -y install dnf-plugins-core
Install Docker Engine
- Install the latest version of Docker Engine and containerd, or go to the next step to install a specific version:
[root@fedora ~]# sudo dnf install docker-ce docker-ce-cli containerd.io
- Start Docker.
[root@fedora ~]# sudo systemctl start docker
- Verify that Docker Engine is installed correctly by running the hello-world image.
[root@fedora ~]# sudo docker run hello-world
- Check Docker version:
sudo docker version
Install Docker Compose
On Linux, you can download the Docker Compose binary from the Compose repository release page on GitHub. Follow the instructions from the link, which involve running the
curl command in your terminal to download the binaries. These step-by-step instructions are also included below.
Run this command to download the current stable release of Docker Compose:
sudo curl -L "https://github.com/docker/compose/releases/download/1.29.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
Apply executable permissions to the binary:
sudo chmod +x /usr/local/bin/docker-compose
Test the installation.
[root@fedora ~]# docker-compose version