Docker Compose Fedora
(06) Use Docker Compose (07) Use Docker-Registry; WEB Server. Apache2 (01) Install Apache2 (02) Use Perl Scripts (03) Use PHP Scripts (04) Use Ruby Scripts (05) Use Python Scripts (06) Enable UserDir (07) Virtual Hostings (08) SSL/TLS Settings (09) Basic Authentication (10) Kerberos Authentication (11) Use WebDAV; Database. MariaDB (01) Install. To Install Docker Compose, it's easy to configure and run multiple containers as a Docker application. Docker Compose is supported on Podman 3.0 or later.
Linux containers
Podman exists to offer a daemonless container engine for managing OCI-compliant containers on your Linux system. Users love it for its ease of adoption as an alternative to Docker. However, many users and the broader container community have been telling us that one missing feature is a 'deal-breaker' for them. Up to now, support for Docker Compose, the command-line utility that orchestrates multiple Docker containers for local development, was missing. With Podman 3.0 now in development upstream, we have begun to support Compose. Here's how it works as a rootful/privileged user.
The following article discusses how to use Compose by using two examples that Docker has curated and maintained in the awesome-compose Git repository.
Start the Podman system service
I am currently using Fedora 33. Before running Compose, ensure that all the required packages are installed and set up the Podman (3.0 or greater) system service using systemd
. Other than Podman and its dependencies, be sure the podman-docker
and docker-compose
packages are installed. After installing the packages, start the Podman systemd
socket-activated service using the following command:
Verify the system service is running by hitting the ping endpoint and see if we get a response. This step needs to be successful before we can proceed further.
We can now confidently run Compose knowing the RESTful API is working.
Examples
As mentioned earlier, I will demonstrate how to use Docker Compose with Podman through two examples. These examples are found at https://github.com/docker/awesome-compose. For these examples, I am cd'ing into the specific directories and executing commands.
Gitea with Postgres
This first example defines a base setup for the project Gitea, which describes itself as a community-managed lightweight code hosting solution written in Golang.
From within the awesome-compose
Git repository, cd
into gitea-postgres
and then issue the docker-compose up
command.
The README for this docker-compose
setup says to visit localhost:3000 in your browser to verify it is working.
The Gitea instance is definitely working. By the Compose output, you can see that docker-compose
has created a network, two volumes, and two containers. We can observe the two containers in another terminal with the podman ps
command.

The network can be seen with podman network ls
.
Lastly, the volumes can be displayed with podman volume ls
.
To bring down the Docker Compose containers, we just need to interrupt docker-compose
with a Ctrl+C.
Traefik proxy with GO backend
The second example uses Traefik to set up a reverse proxy that includes a monitoring dashboard. The YAML file used for this example is as follows:
This YAML differs from the previous one in two specific ways. The first is on line 11. It mounts the Docker socket. In this case, it is a Podman socket; more specifically, it is a symlink to the Podman socket. For this example to work unchanged, we need to ensure SELinux is disabled by temporarily setting setenforce
to 0. The second interesting difference is on line 15. The moniker of build indicates that Compose should use a Dockerfile to build the image in question.
Like the previous example, I begin by cd'ing into treafix-golang
and issuing the docker-compose up
command.
Here you can see that the image build is beginning.
The instructions provided by the Git repository say we can test this instance by performing an HTTP GET against localhost.
Podman worked seamlessly with Docker Compose. Nice!
Caveats
One known caveat is that Podman has not and will not implement the Swarm function. Therefore, if your Docker Compose instance uses Swarm, it will not work with Podman.
Wrap up
Docker Compose is a well-known and used application for orchestrating containers on a local container runtime. We are excited to add it as a supported application with Podman 3.0 and would love your feedback from trying it out. It would be great to see how it works for you or if you have problems (which you can report here.)
With the 3.0 release, Podman can now work nicely with Docker Compose to orchestrate containers, which is a huge step toward daemonless container management on Linux.
[ Getting started with containers? Check out this free course. Deploying containerized applications: A technical overview. ]
Check out these related articles on Enable Sysadmin
Docker Compose is a tool that natively integrates with Docker, and makes managing multi-container applications a breeze.
The benefits Docker Compose provides are numerous, some of which include:
- Manage Container Networks Easily: Connecting two containers via a Docker network is super simple in Docker Compose, being as simple as defining a network and telling the containers to connect to it. In addition, Docker Compose can automatically create and destroy networks as you create and destroy the containers themselves.
- Container Dependencies: You have a Docker container that needs another Docker container to be up and running, say, a database. Docker Compose allows you to define dependencies for a container, requiring the dependencies to be up and running before anything else will start.
- Reproducible Setups: Since the container setup will be defined before anything is even created, this allows for reproducibility of setups, making it easier to transfer them to other systems. While you could theoretically do such in something like Bash, it can make things less flexible and harder to adapt to change.
Installing Docker Compose on Linux
Docker Compose is readily available in most distributions repositories.
You can install Docker Compose on Ubuntu and Debian-based distributions using the following command:
On Arch and Manjaro, you may use:
On Fedora, you can use the dnf command:
You may need to put a bit more effort in installing Docker Compose on CentOS.
For any other distributions, you can always look at the installation docs for information on obtaining the needed packages.
Creating Our First Docker Compose File
Docker Compose files are stored under the name docker-compose.yml
, and are automatically found when you run docker-compose
commands in the same directory. Its syntax takes the form of, you guessed it, YAML.
We have a dedicated tutorial on YAML basics if you are interested in learning about it.
We're going to start with a file that creates a Nextcloud instance, then go over how it actually did what it did.
First things first, you need to create the compose file. Create an empty directory on your system, and create the docker-compose.yml
file.
Next, fill the file with the following content:
Now all you have to run is docker-compose up -d
, and you would have successfully deployed Nextcloud with Docker.
Here's the login page of Nextcloud.
Understanding our Docker Compose File
Now that you have seen that the file actually works, let's go over the contents of the file so that you can actually understand what exactly it's doing.
The 'version' Tag
First things first, the version
tag. This is just specifying the version of the Docker Compose file format, as different versions will have different syntax. You generally want to keep this to the latest version, but it doesn't have to, which can be helpful if you have some legacy files.
The 'services' Tag
Next, you see the services
tag. This starts the list for all the applications that are created when docker-compose up -d
is ran.
Followed by this we start the listing for our first container, nextcloud_app
. This serves as the identifier for the app, which can be used by other Docker Compose commands. Note that this is not the name of the container itself - that's specified in the next part.
Install Docker-compose Fedora 29
Now, you start defining everything about your container. Here is a brush-up on what all the fields mean, though most should be self-explanatory if you already know your way around Docker:
Docker-compose Fedora Coreos
container_name
- Defines the name of the container. Equivalent to the--name
option.image
- Defines what image to pull from for the container.restart
- Defines the restart policy for the container. Equivalent to--restart
.networks
- Defines a network that the container connects to. This network can be created or can already exist. This value serves as an identifier fordocker-compose
and is not the actual name of the network (that's defined in thenetworks
tag section).ports
- Defines host ports that the container can connect to. Equivalent to--publish
.volumes
- Defines volumes for the container. Equivalent to--volume
.environment
- Defines environment variables for the container. Equivalent to--env
. This option supports two syntax types. The first isvariable: value
, which is what is used here. The other option, which may be more familiar if you are used to thedocker
CLI syntax, is- variable=value
.depends_on
- Specifies container dependencies. This is used to require a container to not start until its dependencies have. This accepts values from the container listings. (Notcontainer_name
!)
The 'networks' Tag
Now you get to the networks
tag. This is used to define the networks we listed under networks
for our containers.
Docker Compose Fedora 31
Inside the networks
section, you first list the identifier that you gave to the network under services
. Here, that was nextcloud
.
Next, you define the name of the network that can be seen with docker network ls
. Here, we named it nextcloud_docker_network
.
If you wanted the containers to join a network that already existed, you would use the following syntax, replacing network_name
with the name of the Docker network:
And there you go. That sums up the whole file!
Closing Up
Now you know the basics to using Docker Compose, and the benefits you can get through its use. You're also now on your way to understanding what people are doing when they distribute their containers through Compose files.

Something not working, or got some lingering questions? You are welcome to leave them in the comment section below.