https://github.com/unixorn/docker-cupsd
cupsd in a docker container
https://github.com/unixorn/docker-cupsd
cupsd docker hacktoberfest homelab
Last synced: about 2 months ago
JSON representation
cupsd in a docker container
- Host: GitHub
- URL: https://github.com/unixorn/docker-cupsd
- Owner: unixorn
- License: apache-2.0
- Created: 2020-10-11T05:23:40.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2025-02-13T15:01:12.000Z (4 months ago)
- Last Synced: 2025-04-13T05:44:55.738Z (about 2 months ago)
- Topics: cupsd, docker, hacktoberfest, homelab
- Language: Dockerfile
- Homepage:
- Size: 42 KB
- Stars: 9
- Watchers: 2
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# docker-cupsd
## Table of Contents
- [Run the server](#run-the-server)
- [Add printers to server](#add-printers-to-server)
- [Add the printer to your Mac](#add-the-printer-to-your-mac)`cupsd` in a docker container.
Based on debian:bullseye-slim. Includes [cupsd](https://cups.org) along with every printer driver I could think of.
Admin user & passwords default to **print** / **print**
## Run the server
Start `cupsd` with:
```sh
sudo docker run -d --restart unless-stopped \
-p 631:631 \
--privileged \
-v /var/run/dbus:/var/run/dbus \
-v /dev/bus/usb:/dev/bus/usb \
-v $(pwd)/printers.conf:/etc/cups/printers.conf \
unixorn/cupsd
```or use `docker-compose up` with the following `docker-compose.yaml`:
```yaml
version: '3.9'
services:
cupsd:
image: unixorn/cupsd
volumes:
- './printers.conf:/etc/cups/printers.conf'
- '/dev/bus/usb:/dev/bus/usb'
- '/var/run/dbus:/var/run/dbus'
- /etc/hostname:/etc/hostname:ro
- /etc/localtime:/etc/localtime:ro
- /etc/machine-id:/etc/machine-id:ro
- /etc/timezone:/etc/timezone:ro
privileged: true
ports:
- '631:631'
restart: unless-stopped
```Mounting `printers.conf` into the container keeps you from losing your printer configuration when you upgrade the container later.
## Add printers to server
1. Connect to `http://cupsd-hostname:631`
2. **Adminstration** -> **Printers** -> **Add Printer**## Add the printer to your Mac
1. **System Preferences** -> **Printers**
2. Click on the **+**
3. Click the center sphere icon
4. Put the IP (or better, DNS name) of your server in the Address field
5. Select `Internet Printing Protocol` in the Protocol dropdown
6. Put `printers/YOURPRINTERNAME` in the queue field.## Use with [Home Assistant](https://www.home-assistant.io/)
I blogged how I use this with Home Assistant to automagically turn on my HP 4050N printer when there are print jobs and turn it back off when the jobs are complete [here](https://unixorn.github.io/post/home-assistant-printer-power-management/), but it'll work with any printer.