It is easy to run podman with the docker-compose. The docker composer can be effectively used to orchestrate containers.
Bobcares answers all questions no matter the size, as part of our Docker hosting support
Let us take a look at Podman Docker Compose and running in detail.
Podman
It is a daemonless container engine. It allows the users to develop, manage, and run OCI Containers on their Linux system. Further, it is a tool for finding, running, building, sharing, and deploying applications. It uses Open Containers Initiative (OCI) Containers and Container Images.
Docker compose
Docker Compose is a tool for defining and sharing multi-container applications. With Compose, users can define the services in a YAML file. And the developers use it to orchestrate containers locally or in production.
Requirements for podman docker-compose
To run Docker Compose with Podman, the user must have the podman: Container management software or tool,docker-compose: Container orchestration tool, and finally podman-docker: it installs the docker script, which emulates the docker CLI. It also links Docker CLI man pages and podman. A user can use dnf, to install the mentioned packages:
sudo dnf install -y podman podman-docker docker-compose
Configuring Podman Socket
To make Docker Compose work, configure the Podman socket as follows:
sudo systemctl enable podman.socket
sudo systemctl start podman.socket
sudo systemctl status podman.socket
This creates a Unix socket in which Docker Compose can communicate and symlinks it to /var/run/docker.sock. The user can test the socket communication by running the curl command given below.
sudo curl -H "Content-Type: application/json" --unix-socket /var/run/docker.sock http://localhost/_ping
If the output of the preceding command is OK, the user setup was successful for the docker-compose podman.
Manage Running Containers
To get a list of containers created by Podman Compose, run the following command:
podman ps
The output shows a container named plex that is currently running. Compose.yml defines the name. marko@test-main: /plex-tests podman ps
CONTAINER ID IMAGE CREATED STATUS NAMES 92f8243e6df3docker.io/linuxserver/plex:latest 10 minutes ago Up 7 seconds ago plex marko@test-main: /plex-tests
Stop Containers
The podman stop
command is the standard method for stopping containers in Podman:
podman stop [container-id]
marko@test-main: /plex-test$ podman stop92f8243e6df3 92f8243e6df3
marko@test-main:-/plex-tests
However, there are times when the number of compose containers is too large to manually stop. The following command terminates all containers associated with the Podman Compose deployment:
podman-compose down
The output indicates that Compose has stopped and removed the deployed containers. The pod in which those containers were housed is also removed.
marko@test-main: /plex-test$ podman-compose down podman-compose version: 1.0.4
['podman', '--version', '']
using podman version: 3.2.1
** excluding: set()
podman stop -t 10 plex
plex
exit code: 0
podman rm plex 714556d2ed9076cb735113fc6b68ee15c62747bd40571ed50f6ff0b4f0e1ee13 exit code: 0
podman pod rm pod_plex-test 1f514f261051944df2d78083ce25a2698920444040918bddf15910470915389C exit code: 0
marko@test-main:-/plex-tests
Stopping and removing Pods
A user can also stop and remove pods created by Podman Compose manually. Firstly, to stop a pod, they must enter the following:
podman pod stop [pod-name-or-id]
And after that, the output confirms the deletion of the pod by displaying the entire pod ID.
marko@test-main: /plex-test$ podman pod stop ob1a2db93ba3 ob1a2db93ba3a6b125d180ab279f283ba60a18db9db2a46f20ed8bb19b5aodba marko@test-main:-/plex-tests
As a result, the Plex server terminates and returns to the command prompt.
[plex] | [cont-finish.d] executing container finish scripts... [plex] | [cont-finish.d] done.
[plex] | [s6-finish] waiting for services.
[plex] | [s6-finish] sending all processes the TERM signal. [plex] | [s6-finish] sending all processes the KILL signal and exiting.
exit code: 0 marko@test-main:-/plex-tests
Finally, the following podman pod
command can be used to remove the stopped pods:
podman pod rm [pod-name-or-id]
marko@test-main: /plex-test$ podman pod rm Ob1a2db93ba3 ob1a2db93ba3a6b125d180ab279f283ba60a18db9db2a46f20ed8bb19b5aodba marko@test-main: /plex-test$I
[Need assistance with similar queries? We are here to help]
Conclusion
It is easy to manage and run Podman with Docker Compose. The Docker Compose is a software application for creating and sharing multi-container applications. And, users can use Podman to create, manage, and run OCI Containers on their Linux system.
PREVENT YOUR SERVER FROM CRASHING!
Never again lose customers to poor server speed! Let us help you.
Our server experts will monitor & maintain your server 24/7 so that it remains lightning fast and secure.
var google_conversion_label = "owonCMyG5nEQ0aD71QM";
thanks for sharing this one, but is there anyway to make it work with the ‘links’ in docker-compose?
Hi,
Please contact our support team via live chat