Docker Free Ebook



Use Podman 3.0 to convert Docker Compose YAML to a format Podman recognizes.

The Docker Compose tool has been valuable for many people who have been working with containers. According to the documentation, Docker Compose describes itself as:

... a tool for defining and running multi-container 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.

One challenge with Docker Compose is that the YAML file format only works with the Docker engine. While you can give it to other Docker users for local replication, they cannot use it with other container runtimes. That is, until now.

Free ebook: Build Applications with Kubernetes and Openshift This article explains the process of starting with a simple Compose file that runs WordPress using two containers. The source for this Compose file is published on GitHub in Docker's awesome-compose repository. Command: 'docker build -t dockerdemo.' If your project is successfully built, docker will create an image for it. Now, let's run our image using the command: docker run -d -p 8080:80 -name myapp dockerdemo. Here we are saying docker that run our dockerdemo image at port 8080 with container name myapp.

[ Related tutorial: Using Podman and Docker Compose ]

With Podman 3.0, the Docker Compose works with a Podman backend

The real power of Podman shines through by easily converting the containers based on Docker Compose to a Kubernetes YAML file. Like Docker Compose, Podman can use the Kubernetes YAML file to replicate the containers locally. More importantly, this allows Podman to have an orchestrated pod and service that can be run on many platforms, including Kubernetes/OpenShift or minikube.

Kubernetes and OpenShift

This article explains the process of starting with a simple Compose file that runs WordPress using two containers. The source for this Compose file is published on GitHub in Docker's awesome-compose repository. Successful use of this file with Podman results in the WordPress initial setup screen appearing in a browser.

Note: At the time of this writing, we only support the docker-compose command running rootfully.

Docker Free Ebook

Start Podman's system service

To use Compose, the first step is to make sure that all the required packages are installed and then to set up the Podman (3.0 or greater) system service using systemd. After installing packages, enable and start the Podman systemd socket-activated service using the following command:

Verify the service is running by hitting the ping endpoint. This step needs to be successful before proceeding further.

You can now confidently run Compose knowing the RESTful API is working.

Free

Run Compose

As mentioned earlier, the example will run a Compose file consisting of two containers to bring up a WordPress session. One container runs an Apache web service, and the other stores the data in a MySQL database. The two containers communicate via TCP/IP over a network dedicated to this Compose instance. To bring up the containers, run docker-compose up.

Use the podman ps command to verify that two containers have been created and are now running. No Docker daemon was necessary.

Verify WordPress is running locally

Docker Free Ebooks

The instructions for running WordPress indicate that it is working correctly and it can be accessed using the localhost and port 80.