Files
2026-03-15 21:08:34 -05:00

77 lines
2.6 KiB
Markdown

# Podman
Podman is a container system very similar to docker that lets you run programs in an isolated and self-contained environment. A number of programs, usually those with Web Interfaces can be run with podman.
Podman is built to be a drop-in replacement for Docker, so if you see something that can be run with docker, you can usually just replace "docker" with "podman" and it will work.
Podman has 2 main advantages over Docker:
1. Due to licensing podman is easier to install on Linux, since it is just packaged as normal software.
2. Podman is setup to run without root permissions by default, which generally makes it more secure, and means a user does not need root permissions on their system to use it.
## Install
Podman can be installed by the package manager on your system:
### Arch-Based:
Select `crun` if asked
```sh
sudo pacman -S podman
```
### Debian/Mint/Ubuntu
```sh
sudo apt install podman
```
### Fedora
```sh
sudo dnf install podman
```
## Run a container
A container is simply run with the `podman run` command.
For example, to run the simple debian container from the Docker Hub (https://hub.docker.com/_/debian), you would run the following:
```sh
podman run docker.io/library/debian:latest
```
You man want to expose ports from inside the container onto your computer (so the port can be accessed from outside the container), for example if there is a webserver running in that container you could expose port 80 to port 80 on your computer by adding `-p 80:80` like so:
```sh
podman run -p 80:80 docker.io/library/debian:latest
```
### DockerFile
More commonly projects will provide a DockerFile, which you can just download, when in the directory with that file just run `podman run` and it will use the information from that file.
### Compose
You may also see compose files provided for docker projects, for that you will probably need to install the separate `podman-compose` package, and then `podman-compose` can just be used in place of `docker compose` or `docker-compose`.
For example, being in a directory with a compose file, you can run `podman-compose up` to start the program.
## Manage Containers
### View running containers
You can see all running podman containers with
```sh
podman ps
```
You can additionally view all containers (including stopped) with
```sh
podman ps -a
```
### Stop a container
After running `podman ps` you can see a container's id, and you can use that id to control it.
For example you can stop it with
```sh
podman stop <id>
```
### Delete a container
You can also delete a stopped container with
```sh
podman rm <id>
```