====== How to install SavaPage with Docker ======
https://www.docker.com/
===== Install Docker =====
#install Docker + Compose
sudo apt install docker.io docker-compose-v2
# add yourself to docker group
sudo usermod -aG docker $(whoami)
===== Create Container =====
mkdir -p ~/Docker-containers/savapage
cd ~/Docker-containers/savapage
Copy files below to ''~/Docker-containers/savapage''
==== docker-compose.yml ====
Docker containers are ephemeral by default. Changes made to a container's filesystem won't persist after the container stops.
There are a few different approaches to managing persistent data. The most common is to use a Docker Volume. Volumes are storage units that are mounted into container filesystems. Any data in a volume will remain intact after its linked container stops, letting you connect another container in the future.
services:
savapage:
image: savapage
container_name: savapage
environment:
TZ: Europe/Amsterdam
env_file: docker.env
ports:
# CUPS
- "127.0.0.1:6631:631"
- "[::1]:6631:631"
# http
- "127.0.0.1:8641:8631"
- "[::1]:8641:8631"
# https
- "127.0.0.1:8642:8632"
- "[::1]:8642:8632"
networks:
# IP address assigned by Docker ...
- savapage_network
volumes:
- savapage_custom:/opt/savapage/server/custom
- savapage_data:/opt/savapage/server/data
- savapage_logs:/opt/savapage/server/logs
- savapage_cups:/etc/cups
restart: always
postgres:
image: postgres
container_name: postgres
environment:
- POSTGRES_PASSWORD=savapage
networks:
- savapage_network
volumes:
- savapage_database:/var/lib/postgresql/data
restart: always
networks:
savapage_network:
driver: bridge
volumes:
savapage_custom:
driver: local
savapage_data:
driver: local
savapage_database:
driver: local
savapage_logs:
driver: local
savapage_cups:
driver: local
==== docker.env ====
# Namespace prefix for SavaPage env vars
SAVAPAGE_NS=SP_
# Let SavaPage know it's Dockerized
SP_CONTAINER=DOCKER
# Other values
SP_KEY_1=value-1
SP_KEY_2=value-2
==== Dockerfile ====
A Dockerfile describes how to run your service by installing required software and copying in files.
FROM debian:bookworm
RUN apt update && apt install --no-install-recommends --no-install-suggests -y binutils cpio \
cups cups-bsd debianutils default-jdk-headless gzip imagemagick librsvg2-bin perl poppler-utils \
qpdf supervisor wkhtmltopdf libheif-examples vim-tiny findutils apt-utils iputils-ping \
gnupg curl hplip
COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf
RUN useradd -rmd /opt/savapage -s /bin/bash -G lpadmin savapage && chown savapage:savapage /opt/savapage
ENV SAVAPAGE_VERSION=1.6.0-rc
ENV SAVAPAGE_NS=SP_
ENV SP_CONTAINER=DOCKER
USER savapage
COPY ./savapage-setup-${SAVAPAGE_VERSION}-linux-x64.bin /opt/savapage/savapage-setup.bin
RUN ["bash", "/opt/savapage/savapage-setup.bin", "-n"]
USER root
RUN ["/opt/savapage/server/bin/linux-x64/roottasks", "pam"]
EXPOSE 631 8631 8632
CMD ["/usr/bin/supervisord", "-c", "/etc/supervisor/supervisord.conf"]
==== supervisord.conf ====
[supervisord]
nodaemon=true
[program:cupsd]
command=/usr/sbin/cupsd -f
autostart=true
autorestart=true
[program:cupsctl]
command=/usr/sbin/cupsctl --remote-any
autostart=true
autorestart=true
[program:savapage-cups-notifier]
command=/opt/savapage/providers/cups/linux-x64/roottasks
autostart=true
autorestart=true
user=root
[program:savapage]
command=/opt/savapage/server/bin/linux-x64/app-server start
autostart=true
autorestart=true
user=savapage
===== Build Image =====
Execute all commands in ''~/Docker-containers/savapage''
#!/bin/bash
# Use Dockerfile to construct the image and tag as "savapage".
# Execute if any of the Docker files changed.
docker build -t savapage . 2>&1 | tee ./build.log
===== Run Container =====
==== Start ====
cd ~/Docker-containers/savapage
docker compose up -d
==== CUPS ====
The password for CUPS admin ''savapage'' needs to be set after each start of the container.
# Open shell
docker exec -it savapage bash
# Set password for CUPS admin web interface
passwd savapage
CUPS Web interface: http://127.0.0.1:6631/printers/
==== Admin Web App ====
http://localhost:8641/admin
==== Docker commands ====
# Check running containers
docker ps
# What's in the SavaPage-container?
docker exec -it savapage bash
# List docker volumes
docker volume ls
# List processes
docker ps -a
# List images
docker images
# List dangling images
docker images -f dangling=true
# Remove all the dangling images
docker system prune
==== Stop ====
cd ~/Docker-containers/savapage
docker compose down
==== Remove ====
https://docs.docker.com/reference/cli/docker/image/rm/
# List images
docker images
# ... and remove savapage
docker image rm savapage
https://docs.docker.com/reference/cli/docker/volume/rm/
# List volumes
docker volume ls
# ... and remove them
docker volume rm savapage_savapage_custom
docker volume rm savapage_savapage_data
docker volume rm savapage_savapage_database
docker volume rm savapage_savapage_logs