573 words
3 minutes
Planting Beets

Hi. I’m Saul Podman. Did you know that you have a bad music collection? The music geek’s media organizer says you do, and so do I. I believe that, until managed by an automated process, every singleton, album, and compilation in your library is unorganized. And that’s why I fight for you, audiophiles!

-- Saul Podman

Install Podman#

Follow the official instructions to install Podman on your system.

For those who are not familiar with Docker nor Podman, you might want to read this first, or:

TL;DR (AFAIK)
  • An image is a static (until manually rebuilt) virtual environment built before runtime.
  • A container is a said runtime, which is dynamic, and usually dropped on exit.

Suppose we need to use bash in our project. We would install bash when building our image, so that every container based on this image will have bash available. Whenever we create a new container and run bash, a new .bashrc file will be created, and when we remove the container, this file will also be cleaned.

Build Image#

We will write a Containerfile (which is essentially a Dockerfile) to tell Podman how we want our image to be built.

Containerfile
FROM python:3.13-alpine
RUN apk add --no-cache fish
COPY requirements.txt /tmp
RUN pip install --no-cache-dir -r /tmp/requirements.txt
WORKDIR /root/Music

Here, we use fish as our shell in the container, because it has syntax highlighting, auto suggestion and tab completions by default. The requirements.txt contains only one package beets for now. We will add more when needed.

Then we run

Terminal window
podman build -t beetpod .

to build the image. This tells Podman to build an image tagged beetpod using the Containerfile in current directory.

Run Container#

Run

Terminal window
podman run --rm -it \
-v "$HOME/Music:/root/Music" \
-v "$XDG_CONFIG_HOME/beets:/root/.config/beets" \
beetpod fish

This will run fish in a new container from the beetpod image. It will mount the locations on your local machine to the corresponding locations in the container, start fish in interactive mode in a pseudo-TTY, and auto-remove the container on exit.

WARNING

If $XDG_CONFIG_DIR is not set on your system, you should use $HOME/.config/beets instead.

Make a Makefile#

We can make a Makefile to simplify our commands.

HOME := $(shell echo $$HOME)
XDG_CONFIG_HOME := $(shell echo $$XDG_CONFIG_HOME)
build:
@podman build -t beetpod .
run:
@podman run --rm -it \
-v "$(HOME)/Music:/root/Music" \
-v "$(XDG_CONFIG_HOME)/beets:/root/.config/beets" \
beetpod fish

Now we can build the image and run the container with make build and make run respectively.

Planting Beets
https://johnsmith0x3f.github.io/posts/planting-beets/
Author
johnsmith0x3f
Published at
2025-06-27
License
CC BY-NC-SA 4.0