Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nextcloud-printer within docker #5

Open
Mailblocker opened this issue Jun 2, 2020 · 2 comments
Open

nextcloud-printer within docker #5

Mailblocker opened this issue Jun 2, 2020 · 2 comments
Labels
enhancement New feature or request

Comments

@Mailblocker
Copy link
Contributor

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

  1. A running CUPS server with a shared printer accessable via IPP over the internal network
  2. 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.

@e-alfred e-alfred added the enhancement New feature or request label Jun 8, 2020
@e-alfred
Copy link
Owner

e-alfred commented Jun 8, 2020

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.

@Mailblocker
Copy link
Contributor Author

Mailblocker commented Jun 11, 2020

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants