CUPS server with docker

  • Hi,


    I would like to plug my old printer in my rpi4 on which libre-elec is installed and then print

    All the documentation I found about docker can only install images from linuxserver.io

    But I'd like to install this one Docker Hub

    Is there a way ?

    Or should I go with linuxserver/rdesktop with extra port redirection and install CUPS in it ?


    Thanks for any help


    Solved here : CUPS server with docker

  • Linuxserver.io ones can be installed via addons for added convenience and ease of use but you can use any docker image via command line (docker run) or portainer on libreelec (assuming you're using the correct arch)

  • I finally made it, the problem was not that my printer was not recognized but that I did not "give" the usb bus to the container.

    An other problem I encountered was that kodi already used the avahi port and and needed it to advertise my printer on my local network

    I solved that by asking for a second IP for my device

    Code
    1. ip addr add 192.168.1.32 dev eth0

    Check your printer can be found with

    Code
    1. lsusb

    Save its location in a variable, my printer is a Canon, change with yours

    Code
    1. BUS=$(/opt/sbin/lsusb|grep Canon|awk '{print $2}')
    2. DEV=$(/opt/sbin/lsusb|grep Canon|awk '{print $4}')
    3. DEV="${DEV%?}"
    4. PRINTER="/dev/bus/usb/$BUS/$DEV"

    Then I finally ran the docker command

    Code
    1. docker run -d -p 192.168.1.32:631:631 -p 192.168.1.32:5353:5353 -e ADMIN_PASSWORD=mySecretPassword --name cups-server --device=$PRINTER ydkn/cups:latest

    Now, from another device on the local network try https://192.168.1.32:631, go in the administration panel and add your printer (username admin, password mySecretPassword which you have of course changed)


    Now add a printer, search a printer a the network, host 192.168.1.32 and you should find it


    Many thanks to Setting up a CUPS server with Docker on a Synology NAS for my Brother printer