8i | 9i | 10g | 11g | 12c | 13c | 18c | 19c | 21c | 23c | Misc | PL/SQL | SQL | RAC | WebLogic | Linux
Home » Articles » Linux » Here
Podman : Install Podman on Oracle Linux 8 (OL8)
Oracle Linux 8 (OL8) includes Podman, Buildah and Skopeo in the "ol8_appstream" repository, as described here. We can think of Podman as a replacement for Docker, with an almost identical syntax. This article demonstrates how to install Podman on Oracle Linux 8 (OL8).
- Assumptions
- Install Podman
- Configure Repositories (Optional)
- Configure Disk (Optional)
- Podman Commands as Non-Root User
- Comments
Related articles.
Assumptions
This article makes the following assumptions.
- You have a server (physical or virtual) with Oracle Linux 8 (OL8) installed. This is described here.
- You have a separate partition to hold the images and containers. In this article we have a separate virtual disk.
Install Podman
The installation of Podman is really simple. We don't even have to amend the default repositories.
dnf install -y podman
That's the only mandatory bit!
Because the Podman syntax is so similar to Docker, there is a package that creates the docker
alias to run podman
commands.
dnf install -y podman-docker
You may also want to install Buildah and Skopeo also.
dnf install -y buildah skopeo
I usually start with a cut-down VM, so I make sure I add some extra packages to handle archive files and Git.
dnf install -y dnf-utils zip unzip tar gzip git
Configure Repositories (Optional)
If you are used to using Docker and want to make Docker Hub images available, make the following change in the "/etc/containers/registries.conf" file.
# From: [registries.search] registries = ['container-registry.oracle.com', 'registry.access.redhat.com', 'registry.redhat.io'] # To: [registries.search] registries = ['docker.io', 'container-registry.oracle.com', 'registry.access.redhat.com', 'registry.redhat.io']
Configure Disk (Optional)
Docker stores images in the "/var/lib/docker" directory. Podman uses the "/var/lib/containers" directory instead. We want to mount a partition on the "/dev/sdc" device for this location.
MOUNT_POINT=/var/lib/containers DISK_DEVICE=/dev/sdc # New partition for the whole disk. echo -e "n\np\n1\n\n\nw" | fdisk ${DISK_DEVICE} # Add file system. mkfs.xfs -f ${DISK_DEVICE}1 # Mount it using the UUID of the VirtualBox virtual disk. UUID=`blkid -o export ${DISK_DEVICE}1 | grep UUID | grep -v PARTUUID` mkdir ${MOUNT_POINT} echo "${UUID} ${MOUNT_POINT} xfs defaults 1 2" >> /etc/fstab mount ${MOUNT_POINT}
Podman Commands as Non-Root User
Podman commands run as the "root" user, but it makes sense to run the commands from another user using the sudo
command. In this case we want to run the Podman commands from a user called "container_user", so we add an entry in the "/etc/sudoers" file and use an alias in the user's ".bash_profile" file so we don't have to keep typing the "sudo" command.
# useradd container_user # echo "container_user ALL=(ALL) NOPASSWD: /usr/bin/podman" >> /etc/sudoers # echo "alias podman=\"sudo /usr/bin/podman\"" >> /home/container_user/.bash_profile # su - container_user $ podman ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES $
You can also add an alias for Docker, as you will no doubt type it by accident a lot in the early days. I prefer this option to using the podman-docker package.
# echo "alias docker=\"sudo /usr/bin/podman\"" >> /home/container_user/.bash_profile
Comments
Podman supports most of the Docker commands and flags, so for the most part you should be able to just substitute the word "podman" for "docker". For example the following give the same result.
docker ps -a podman ps -a
One exception to this is the way network ports are exposed. In Podman the ports for a container are hidden unless explicitly exposed by the pod that houses the containers. This will be covered in another article. You can see an example of that in the following article.
For more information see:
- Podman, Buildah, and Skopeo Container Tools Included
- Podman
- Welcome to Podman’s documentation!
- Buildah
- Skopeo
- Install Podman on Oracle Linux 8 (OL8)
- Docker/Container Articles
Hope this helps. Regards Tim...