Podman is a drop-in replacement for Docker, at least that's what I hear.
From the little experience I currently have, the commands on the command line seem to be almost equivalent if not in syntax at least in intention to Docker.
Installing Podman
mrbear % brew install podman
Running Podman
podman machine init
Downloading VM image: fedora-coreos-38.20230514.2.0-qemu.aarch64.qcow2.xz: done
Extracting compressed file
Image resized.
Machine init complete
To start your machine run:
podman machine start
Downloading VM image: fedora-coreos-38.20230514.2.0-qemu.aarch64.qcow2.xz: done
Extracting compressed file
Image resized.
Machine init complete
To start your machine run:
podman machine start
podman machine start
Starting machine "podman-machine-default"
Waiting for VM ...
Mounting volume... /Users:/Users
Mounting volume... /private:/private
Mounting volume... /var/folders:/var/folders
This machine is currently configured in rootless mode. If your containers
require root permissions (e.g. ports < 1024), or if you run into compatibility
issues with non-podman clients, you can switch using the following command:
podman machine set --rootful
API forwarding listening on: /Users/mrbear/.local/share/containers/podman/machine/qemu/podman.sock
The system helper service is not installed; the default Docker API socket
address can't be used by podman. If you would like to install it run the
following commands:
sudo /opt/homebrew/Cellar/podman/4.5.0/bin/podman-mac-helper install
podman machine stop; podman machine start
You can still connect Docker API clients by setting DOCKER_HOST using the
following command in your terminal session:
export DOCKER_HOST='unix:///Users/mrbear/.local/share/containers/podman/machine/qemu/podman.sock'
Machine "podman-machine-default" started successfully
Starting machine "podman-machine-default"
Waiting for VM ...
Mounting volume... /Users:/Users
Mounting volume... /private:/private
Mounting volume... /var/folders:/var/folders
This machine is currently configured in rootless mode. If your containers
require root permissions (e.g. ports < 1024), or if you run into compatibility
issues with non-podman clients, you can switch using the following command:
podman machine set --rootful
API forwarding listening on: /Users/mrbear/.local/share/containers/podman/machine/qemu/podman.sock
The system helper service is not installed; the default Docker API socket
address can't be used by podman. If you would like to install it run the
following commands:
sudo /opt/homebrew/Cellar/podman/4.5.0/bin/podman-mac-helper install
podman machine stop; podman machine start
You can still connect Docker API clients by setting DOCKER_HOST using the
following command in your terminal session:
export DOCKER_HOST='unix:///Users/mrbear/.local/share/containers/podman/machine/qemu/podman.sock'
Machine "podman-machine-default" started successfully
Verify Podman
podman info
A GUI
I will be trying out Podman Desktop. Under Docker I was very used to Portainer.
Networking
Non-root containers use slirp4netns and have no routable IP address. Root containers use netavark.
Glossary of commands
- podman machine init
- initializes the machine
- podman machine start
- starts the machine
- podman info
- verify installation
- podman ps [-a]
- list creating and running containers
- podman pull <container url>
- pull an image, for example "podman pull docker.io/library/postgres:14" or simply "podman pull mariadb"
- podman images
- show all images
- podman rmi <image>
- remove an image, for example "podman rmi 0c1418f4071b", where the id can be ascertained using "podman images"
- podman run ...
- run a container, for example:
- podman run --detach --tty --name webserver --publish 8080:80 quay.io/libpod/banner
- podman run --name postgres --detach --publish 5432:5432 --env POSTGRES_USER=admin --env POSTGRES_PASSWORD=Passw0rd postgis/postgis
- podman run --name postgres --detach --publish 5432:5432 --env POSTGRES_USER=admin --env POSTGRES_PASSWORD=Passw0rd docker.io/library/postgres:latest
- podman run --detach --name mariadb --publish 3306:3306 --env MARIADB_USER=root --env MARIADB_PASSWORD=Passw0rd --env MARIADB_ROOT_PASSWORD=Passw0rd docker.io/library/mariadb
- --detach/-d
- run the container in the background and print the new container ID. The default is false.
- --tty/-t
- Allocate a pseudo-TTY. The default is false.
- --publish/-p [[ip:][hostPort]:]containerPort[/protocol]¶
- Publish a container’s port, or range of ports, to the host.
- --env/-e
- Set environment variables.
- --name
- Assign a name to the container.
- podman ps
- lists the running containers on the system. Use the --all flag to view all the containers information.
- podman attach <container_id>
- sttached tty to a running container
- podman inspect -l
- metadata and details about the running containers
- podman logs <container_id>
- log container logs
- podman top <container_id>
- show processes running in the container
- podman start <container_id>
- start a container
- podman stop <container_id>
- stop a container
- podman rm <container_id>
- remove a container
I'll add to this as I get more information.
References
- Podman
- https://podman.io/
- Podman - Installation
- https://podman.io/docs/installation
- TechViewLeo - How To Run PostgreSQL 14|13 in Podman Container
- https://techviewleo.com/how-to-run-postgresql-in-podman-container/?utm_content=cmp-true
- podman desktop
- https://podman-desktop.io/
- ImaginaryCloud - Podman vs Docker: What are the differences?
- https://www.imaginarycloud.com/blog/podman-vs-docker/
- Portainer
- https://www.portainer.io/
No comments:
Post a Comment