Add more details to podman post

This commit is contained in:
Dave Gallant
2021-10-16 17:10:02 -04:00
parent 560b7f6f56
commit d7b1cf136a

View File

@@ -44,27 +44,27 @@ This post briefly describes my experience swapping out docker for podman on macO
### What is a container?
A container is a standard unit of software that packages up all application dependencies within it. Multiple containers can be run on a host machine all sharing the same kernel as the host. In Linux, namespaces help provide an isolated view of the system, including mnt, pid, net, ipc, uid, cgroup, and time. There is an [in-depth video](https://www.youtube.com/watch?v=sK5i-N34im8) that discusses what containers are made from, and [near the end](https://youtu.be/sK5i-N34im8?t=2468) there is a demonstration on how to build your own containers from the command line.
A container is a standard unit of software that packages up all application dependencies within it. Multiple containers can be run on a host machine all sharing the same kernel as the host. Linux namespaces help provide an isolated view of the system, including mnt, pid, net, ipc, uid, cgroup, and time. There is an [in-depth video](https://www.youtube.com/watch?v=sK5i-N34im8) that discusses what containers are made from, and [near the end](https://youtu.be/sK5i-N34im8?t=2468) there is a demonstration on how to build your own containers from the command line.
By easily allowing the necessary dependencies to live alongside the application code, containers make the "works on my machine" problem less of a problem.
### Benefits of podman
### Benefits of Podman
One of the most interesting features of podman is that it is daemonless. There isn't a process running on your system managing your containers. In contrast, the docker client is reliant upon the docker daemon (often running as root) to be able to build and run containers.
One of the most interesting features of Podman is that it is daemonless. There isn't a process running on your system managing your containers. In contrast, the docker client is reliant upon the docker daemon (often running as root) to be able to build and run containers.
Podman is rootless by default. It is now possible to [run the docker daemon rootless](https://docs.docker.com/engine/security/rootless/) as well, but it's still not the default behaviour.
I've also observed that so far my 2019 16" Macbook Pro hasn't sounded like a jet engine, although I haven't performed any disk-intensive operations yet.
### Installing podman
### Installing Podman
Running podman on macOS is more involved than on Linux, because the podman-machine must run Linux inside of a virtual machine. Fortunately, the installation is made simple with [brew](https://formulae.brew.sh/formula/podman) (read [this](https://podman.io/getting-started/installation#linux-distributions) if you're installing podman on Linux):
Running Podman on macOS is more involved than on Linux, because the podman-machine must run Linux inside of a virtual machine. Fortunately, the installation is made simple with [brew](https://formulae.brew.sh/formula/podman) (read [this](https://podman.io/getting-started/installation#linux-distributions) if you're installing Podman on Linux):
```sh
brew install podman
```
The podman machine must be started:
The podman-machine must be started:
```sh
# This is not necessary on Linux
@@ -72,6 +72,8 @@ podman machine init
podman machine start
```
### Running a container
Let's try to pull an image:
```console
@@ -87,7 +89,7 @@ Storing signatures
> If you're having an issue pulling images, you may need to remove `~/.docker/config.json` or remove the set of auths in the configuration as mentioned [here](https://stackoverflow.com/a/69121873/1191286).
and then exec into the container:
and then run and exec into the container:
```console
$ podman run --rm -ti alpine
@@ -104,6 +106,8 @@ podman run -p 4242 --rm -ti alpine
If you're reading this from the future, there is a good chance specifying a port won't be needed.
Another example of running a container with Podman can be found in the [Jellyfin Documentation](https://jellyfin.org/docs/general/administration/installing.html#podman).
### Aliasing docker with podman
Force of habit (or other scripts) may have you calling `docker`. To work around this:
@@ -114,11 +118,10 @@ alias docker=podman
### podman-compose
You may be wondering: what about docker-compose? Well, there happens to be a drop-in replacement for it: [podman-compose](https://github.com/containers/podman-compose).
You may be wondering: what about docker-compose? Well, there *claims* to be a drop-in replacement for it: [podman-compose](https://github.com/containers/podman-compose).
```sh
pip3 install --user podman-compose
alias docker-compose=podman-compose
```
Now let's create a `docker-compose.yml` file to test:
@@ -136,7 +139,7 @@ EOF
Now run:
```console
$ docker-compose up
$ podman-compose up
podman pod create --name=davegallant.github.io --share net
40d61dc6e95216c07d2b21cea6dcb30205bfcaf1260501fe652f05bddf7e595e
0
@@ -155,14 +158,15 @@ podman start -a davegallant.github.io_hello_world_1
Hello world
```
This should more or less provide the same results you would come to expect with docker.
This should more or less provide the same results you would come to expect with docker. The README does clearly state that podman-compose is under development.
### Summary
> Update: After further usage, bind mounts do not seem to work when the client and host are on different machines. See [this issue](https://github.com/containers/podman/issues/8016).
Installing Podman on macOS was not seamless, but it was manageable well within 30 minutes. I would recommend giving Podman a try to anyone who is unhappy with experiencing forced docker updates, or who is interested in using a more modern technology for running containers.
Installing podman on macOS was not seamless, but it was manageable well within 30 minutes. I would recommend giving podman a try to anyone who is unhappy with experiencing forced docker updates, or who wants to use a more modern technology for managing containers.
One caveat to mention is that there isn't an official graphical user interface for Podman, but there is an [open issue](https://github.com/containers/podman/issues/11494) considering one. If you rely heavily on Docker Desktop's UI, you may not be as interested in using podman yet.
One caveat to mention is that there isn't an official graphical user interface for podman, but there is an [open issue](https://github.com/containers/podman/issues/11494) considering one. If you rely heavily on Docker Desktop's UI, you may not be as interested in using podman yet.
> Update: After further usage, bind mounts do not seem to work out of the box when the client and host are on different machines. A rather involved solution using [sshfs](https://en.wikipedia.org/wiki/SSHFS) was shared [here](https://github.com/containers/podman/issues/8016#issuecomment-920015800).
I had been experimenting with podman on Linux before writing this, but after listening to this [podcast episode](https://kubernetespodcast.com/episode/164-podman/), I was inspired to give podman a try on macOS.
I had been experimenting with Podman on Linux before writing this, but after listening to this [podcast episode](https://kubernetespodcast.com/episode/164-podman/), I was inspired to give Podman a try on macOS.