Bobcares

Podman Docker Compose: How to?

by | Jul 15, 2022

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 podcommand 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.

GET STARTED

2 Comments

  1. James

    thanks for sharing this one, but is there anyway to make it work with the ‘links’ in docker-compose?

    Reply
    • Hiba Razak

      Hi,
      Please contact our support team via live chat

      Reply

Submit a Comment

Your email address will not be published. Required fields are marked *

Never again lose customers to poor
server speed! Let us help you.

Privacy Preference Center

Necessary

Necessary cookies help make a website usable by enabling basic functions like page navigation and access to secure areas of the website. The website cannot function properly without these cookies.

PHPSESSID - Preserves user session state across page requests.

gdpr[consent_types] - Used to store user consents.

gdpr[allowed_cookies] - Used to store user allowed cookies.

PHPSESSID, gdpr[consent_types], gdpr[allowed_cookies]
PHPSESSID
WHMCSpKDlPzh2chML

Statistics

Statistic cookies help website owners to understand how visitors interact with websites by collecting and reporting information anonymously.

_ga - Preserves user session state across page requests.

_gat - Used by Google Analytics to throttle request rate

_gid - Registers a unique ID that is used to generate statistical data on how you use the website.

smartlookCookie - Used to collect user device and location information of the site visitors to improve the websites User Experience.

_ga, _gat, _gid
_ga, _gat, _gid
smartlookCookie
_clck, _clsk, CLID, ANONCHK, MR, MUID, SM

Marketing

Marketing cookies are used to track visitors across websites. The intention is to display ads that are relevant and engaging for the individual user and thereby more valuable for publishers and third party advertisers.

IDE - Used by Google DoubleClick to register and report the website user's actions after viewing or clicking one of the advertiser's ads with the purpose of measuring the efficacy of an ad and to present targeted ads to the user.

test_cookie - Used to check if the user's browser supports cookies.

1P_JAR - Google cookie. These cookies are used to collect website statistics and track conversion rates.

NID - Registers a unique ID that identifies a returning user's device. The ID is used for serving ads that are most relevant to the user.

DV - Google ad personalisation

_reb2bgeo - The visitor's geographical location

_reb2bloaded - Whether or not the script loaded for the visitor

_reb2bref - The referring URL for the visit

_reb2bsessionID - The visitor's RB2B session ID

_reb2buid - The visitor's RB2B user ID

IDE, test_cookie, 1P_JAR, NID, DV, NID
IDE, test_cookie
1P_JAR, NID, DV
NID
hblid
_reb2bgeo, _reb2bloaded, _reb2bref, _reb2bsessionID, _reb2buid

Security

These are essential site cookies, used by the google reCAPTCHA. These cookies use an unique identifier to verify if a visitor is human or a bot.

SID, APISID, HSID, NID, PREF
SID, APISID, HSID, NID, PREF