Blender 5.1 using Alpine's system Python, with FFmpeg and pytest
1.0K
Blender and FFmpeg on Alpine Linux, for rendering scenes and running Python scripts in Blender without a window.
Docker Hub · Source · All images
| Base image | alpine:3.24.4 |
| Software | Blender 5.1.2 (Alpine package, with Alpine's system Python) |
| Also included | FFmpeg, Python 3 with bpy, NumPy, pytest and Requests, xterm, bash, ShellCheck, Ruff 0.17.6 (pip) |
| User | blender (uid 1000) with passwordless doas (doas apk add ...) |
| Tags | latest, 5.1.2, 5.1.2-YYYYMMDD |
Run in an empty directory; the commands work on the files of the current directory, mounted as the home directory of the container. CI runs these commands to check that they work.
# open a shell, with the current directory as the home directory
docker run --rm -it -v .:/home/blender -w /home/blender aljazmc/blender-alpine
# render frame 1 of scene.blend to render_0001.png
docker run --rm -v .:/home/blender -w /home/blender aljazmc/blender-alpine blender -b scene.blend -o //render_#### -f 1
# encode the rendered frames to render.mp4 with FFmpeg
docker run --rm -v .:/home/blender -w /home/blender aljazmc/blender-alpine ffmpeg -framerate 24 -i render_%04d.png render.mp4
## docker-compose.yml file
services:
blender:
image: aljazmc/blender-alpine
user: ${UID:-1000}:${GID:-1000}
working_dir: /home/blender
volumes:
- .:/home/blender
- /home/$USER/.Xauthority:/home/blender/.Xauthority
- $XDG_RUNTIME_DIR:/run/user/1000
- /tmp/.X11-unix:/tmp/.X11-unix
- /var/lib/dbus/machine-id:/var/lib/dbus/machine-id
devices:
- /dev/dri:/dev/dri
- /dev/snd:/dev/snd
group_add:
- "992" # render group: stat -c %g /dev/dri/renderD128
- "44" # video group: stat -c %g /dev/dri/card0
- "29" # audio group: stat -c %g /dev/snd/controlC0
environment:
DISPLAY: $DISPLAY
HOME: /home/blender
XDG_RUNTIME_DIR: /run/user/1000
network_mode: host
## start container shell
docker compose run --rm blender sh -c "sh"
## render frame 1 of scene.blend to render_0001.png
docker compose run --rm blender sh -c "blender -b scene.blend -o //render_#### -f 1"
render, video and audio groups (group_add) to use the GPU and the sound card. Without them, apps fall back to software rendering. The group ids differ between distributions: stat -c %g /dev/dri/renderD128 /dev/dri/card0 /dev/snd/controlC0.DISPLAY, /tmp/.X11-unix) and the host's PipeWire/PulseAudio (XDG_RUNTIME_DIR).blender -b file.blend --python script.py works.ffmpeg is included for encoding rendered frames into video.bash and findutils (GNU find) are included for bash scripts that use find -printf.latest: the newest build.5.1.2: the Blender version in the image, e.g. aljazmc/blender-alpine:5.1.2. Use it to stay on a known version.5.1.2-YYYYMMDD: the same version, built on that date (UTC), e.g. 5.1.2-20261122. Every build gets its own tag that never moves, so use it where you need exactly the same image again.blender package, pinned to the 5.1 series with BLENDER_VERSION in the Dockerfile (blender~5.1), so the newest 5.1.x patch release in Alpine 3.24 is installed.The Dockerfile, the scripts and this README are part of aljazmc/dockerfiles, released under the MIT License.
The software in the image keeps its own license:
| Software | License | In the image |
|---|---|---|
| Blender | GPL-2.0-or-later | apk info --license blender |
Every other package keeps its license too: apk info --license <package> shows it on Alpine, /usr/share/doc/<package>/copyright on Debian.
Content type
Image
Digest
sha256:5b9570370…
Size
542.6 MB
Last updated
2 days ago
docker pull aljazmc/blender-alpine