nextcloud-printer
nextcloud-printer copied to clipboard
nextcloud-printer within docker
Hi, thanks for the great addon e-alfred! After some investigation I got it working for my nextcloud instance running within a docker container. I leave it here, just in case someone needs this.
Preconditions
- A running CUPS server with a shared printer accessable via IPP over the internal network
- A nextcloud docker instance
The following changes will build the docker nextcloud image based on nextcloud:fpm (if needed change the image) with the packages cups-client, cups-daemon and cups-bsd installed. Additionally a startup script (myNextcloud.sh) is added. It will start the cups service, add a remote printer (change the IP and the printer name accoringly to the CUPS server) via IPP and set this printer as the default CUPS printer. Afterwards the entrypoint.sh script of the docker nextcloud image is started.
docker compose file
...
nextcloud:
# image: nextcloud:fpm
build:
context: .
dockerfile: myNextcloud
...
Dockerfile: myNextcloud
FROM nextcloud:fpm
ADD myNextcloud.sh /
RUN apt-get update && apt-get install -y cups-client cups-daemon cups-bsd && chmod +x /myNextcloud.sh
ENTRYPOINT ["/myNextcloud.sh"]
CMD ["php-fpm"]
Startscript: myNextcloud.sh
#!/usr/bin/env sh
service cups start
lpadmin -p HP_M281_docker -E -v ipp://192.168.2.42:631/printers/HP_M281 -m everywhere
lpoptions -d HP_M281_docker
sh /entrypoint.sh "$@"
@e-alfred If needed feel free to add it to the documentation, I can also provide a PR.
Question: Is it possible to use lp instead of lpr as the printer command in the plugin? Doing this would not make it neccessary to install cups-bsd.
If you can make a PR, that would be awesome! Using lp
instead of lpr
might be possible but I had some permissions problems with it so I opted for lpr
for now.
Ah okay, could be since I'm using the plugin within a docker container the call lpr
should be executed as root
. Therefore I might not have any troubles with lp
but others might.