aboutsummaryrefslogtreecommitdiff
path: root/content/posts/2023-05-02-bookworm-and-podman.md
blob: 63b842d735fbb4ac0722bfef6c36c599ec97d370 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
---
slug: bookworm-and-podman
title: "Bookworm and Podman"
date: "2023-05-02T01:27:00-04:00"
---
I've spent the last couple days fiddling with [Debian Bookworm
RC2][bookworm] in a VM.  No issues to report.  It's shaping up to be
a great release.

I've been looking for a suitable [Docker][] replacement for a few years
because of [their repeated license shenanigans][license-shenanigans].
Last year I tried switching to [Podman][], but ran into into several
incompatibilities and minor annoyances.

[Podman 4.3][podman-4.3] ships with [Bookworm][] and seems to fix all
the issues I had before.  [Rootless containers][], [multi-stage
builds][multi-stage], and all of my muscle-memory `docker` commands now
work as expected.  There is even a decent clone of [docker-compose][]
named (surprise!) [podman-compose][].

The only real differences I noticed are:

1. The command is `podman` instead of `docker`.
2. Image names must be registry-prefixed.  Example: `FROM docker.io/bash` instead of `FROM bash`.
3. Searches must be registry-prefixed.  Example: `podman search docker.io/pablotron`.

A couple of quick tests:

* [Sinatra web application (rootless)][sinatra-test]
* [Go web application (rootless, scratch, multi-stage build)][go-test]

**Update (2023-05-05):** I put together a [simple web application named
Bookman][bookman] to put [podman-compose][] through it's paces.  It uses
multiple containers, [multi-stage builds][multi-stage], boot
dependencies, secrets, and volumes.

[Here's a log of the setup process][bookman-gist], and [here's a
screenshot][bookman-shot] of the exposed web interface.

**Update (2023-05-13):** I upgraded several VMs from [Bullseye][] (and
one from [Stretch][]!?!) to [Bookworm][], without any significant
issues.

After upgrading to [Bookworm][], I migrated two VMs from [Docker][] to
[Podman][] and installed [Podman][] on a third VM.  Useful tip:
[Rootless][rootless containers] [Podman][] does not agree with an
[NFS][]-mounted home directory.

One workaround is to create a local (that is, non-[NFS][]), user-owned
directory and then symlink `~/.local/share/containers` to it, like so:

```bash
# create local containers directory for user pabs,
# then symlink ~pabs/.local/share/containers to it.
sudo mkdir -pm 700 /data/containers/pabs && \
  sudo chown pabs:pabs /data/containers/pabs && \
  ln -s /data/containers/pabs ~pabs/.local/share/containers
```
 

Alternatively, the [Podman man page][] and [Storage Table section of the
`storage.conf` documentation][storage.conf docs] suggest editing the
`graphroot` in `~/.config/containers/storage.conf` and pointing  at a
local directory.

[bookworm]: https://www.debian.org/releases/bookworm/
  "Debian bookworm."
[bullseye]: https://www.debian.org/releases/bullseye/
  "Debian bullseye."
[stretch]: https://www.debian.org/releases/stretch/
  "Debian stretch."
[debian]: https://debian.org/
  "Debian Linux."
[docker]: https://www.docker.com/
  "Docker container manager."
[podman]: https://podman.io/
  "Podman container manager."
[podman-4.3]: https://github.com/containers/podman/releases/tag/v4.3.0
  "Podman version 4.3."
[rootless containers]: https://developers.redhat.com/blog/2020/09/25/rootless-containers-with-podman-the-basics
  "Rootless containers."
[multi-stage]: https://docs.docker.com/build/building/multi-stage/
  "Multi-stage build."
[sinatra-test]: https://gist.github.com/pablotron/86cb0b355ac3e4cef3b28b3e0718314d
  "Test Sinatra web application running in a Podman container."
[go-test]: https://gist.github.com/pablotron/03785b66cc9e90ebd5fdaef5642baa6d
  "Test Go web application running in a Podman container."
[license-shenanigans]: https://blog.alexellis.io/docker-is-deleting-open-source-images/
  "Docker is deleting Open Source organizations (updated)."
[podman-compose]: https://github.com/containers/podman-compose
  "Podman-compatible clone of Docker Compose."
[docker-compose]: https://docs.docker.com/compose/
  "Tool for defining and running multi-container Docker applications."
[bookman]: https://github.com/pablotron/bookman
  "Bookman GitHub repository."
[bookman-gist]: https://gist.github.com/pablotron/f19037d1718224611efd7aa6e05f82b6
  "Annotated log of commands to start Bookman with podman-compose."
[bookman-shot]: /files/posts/bookworm-and-podman/bookman.png
  "Bookman web interface deployed via podman-compose."
[nfs]: https://en.wikipedia.org/wiki/Network_File_System
  "Network File System"
[podman man page]: https://docs.podman.io/en/latest/markdown/podman.1.html
  "HTML-formatted man page for podman command."
[storage.conf docs]: https://github.com/containers/storage/blob/main/docs/containers-storage.conf.5.md#storage-table