Whenever Podman Compose comes to mind, immediately the concept of the seamless engine comes to mind. Yes, the Podman Compose is the alternative to Docker, and it also contains the containers and all other features which Docker-Compose contains. Podman is used for developing and managing containers on Linux distributions.
In this write-up, installation of the Podman Composes on Ubuntu Jammy Jellyfish has been demonstrated using the terminal. The content of the post:
- Method 1: Using Pip
- Method 2: Using Tar package
- Method 3: Using Python Script
- How to Use the Podman Compose on Ubuntu 22.04?
Let’s start!
Method 1: How to Install Podman Compose on Ubuntu 22.04 Using Pip?
We will install Podman on Ubuntu using its Python binaries and then install the Podman Compose.
Step 1: Install Pip
First of all, make sure the Pip has been installed in Ubuntu by installing the package of the python3-pip using the command:
$ sudo apt install python3-pip -y
Step 2: Install Podman Compose
Then, install the Podman Compose using the pip command:
$ pip3 install podman-compose
Method 2: How to Install Podman Compose on Ubuntu 22.04 Using Tar Package?
The Podman Compose has been installed but if the users want to install the latest version of Podman Compose, then run the below-mentioned command:
$ sudo pip3 install https://github.com/containers/podman-compose/archive/devel.tar.gz
Method 3: How to Install Podman Compose on Ubuntu 22.04 Using Python Script?
Another method of installing the Podman Compose is by using the python script:
$ sudo curl -o /usr/local/bin/podman-compose https://raw.githubusercontent.com/containers/podman-compose/devel/podman_compose.py
Make the file executable by changing its access permissions:
$ sudo chmod +x /usr/local/bin/podman-compose
How to Use the Podman Compose on Ubuntu?
To use the Podman Compose, follow the steps mentioned below:
Step 1: Make and Navigate to New Directory
First make the directory of “plex-test” using the mkdir command to make the container of the Plex and navigate to the directory using the cd command:
$ mkdir plex-test && cd plex-test
Step 2: Install Podman
Then, install the “Podman” using the apt package manager:
$ sudo apt install podman
Step 3: Create a Compose File
After the installation of Podman, we have to create a file to assign the network and path of media to the new Compose file. The file is created in the yaml format to define the services of Plex with the “compose” name. For this, open the compose file using the nano text editor:
$ nano compose.yml
Copy and paste the below-mentioned script in the newly opened file:
services:
plex:
image: docker.io/linuxserver/plex
container_name: plex
network_mode: host
environment:
- VERSION=podman
restart: always
volumes:
- ${PLEX_MEDIA_PATH}:/media/
The explanation of the above script, we define plex to be the image of the docker. Then assign the “plex” to the container name and define network mode as the “host”. We set the restart behaviour to “Always” and the /media/ directory for storing the media files of the Plex.
Step 4: Create a Pod
Now, create the Pod of the above script in the “plex-test” directory, create the containers specified in the above command, and also add them in the yml file using the command:
$ podman-compose up
Step 5: Browse the Plex
Then, open the browser and go to the URL:
http://localhost:32400/web
The Plex Web page has been opened to which you can log in by using any of the social media accounts mentioned in the figure. And to display the list of the containers of Podman Compose, use the command:
$ podman ps
All the containers are displayed.
These are all the methods to install Podman Compose on Ubuntu 22.04.
Conclusion
To install Podman Compose, run the command “sudo apt install podman” in Ubuntu after downloading prerequisite files, which are explained in the blog. This write-up explores different installation methods with the basic usage of Podman Compose on Ubuntu. In this blog, the Podman Composes’ usage with the Pod’s creation has also been explained.