Setting up local USB printer with CUPS via Portainer

I thought I’d share how I deployed CUPS via Portainer alongside hassio. I am a beginner using docker and it wasn’t clear how I would start, so hopefully this helps someone.

I am using the Portainer addon, so make sure you have that (Supervisor > Add-on Store > Portainer).

*and for the advanced users, please let me know if I am mis-configuring something!

  1. Add container
    image

    • Input a name
      • I am using “rpi-cups”
    • Input name of docker image from hub (*this is just the name; it will pull the image)
      • I am using “lemariva/rpi-cups:latest” but probably any CUPS docker with a raspberry-pi implementation would work
    • Make sure “Always pull the image” is enabled
    • Click on “publish a new network port” and set it from 631 to 631
      image
    • Go to “Volumes”
    • “map additional volume” then set to “Bind”
      /var/run/dbus:/var/run/dbus
    • “map additional volume” then set to “Bind”
      /dev/bus/usb:/dev/bus/usb
      image
    • Go to “Restart policy”
    • Choose “Unless stopped”
      image
    • Go to “Runtime & Resources”
    • Enable “Privileged mode”
      image
  2. Go back up top and “Deploy the container”
    image

After that, you should be able to access CUPS via http://localhassip:631 and setup your printer.

5 Likes

Thank you so much for this. I have been googling for hours trying to find a portainer or docker option for cups. Honestly I never heard of this site, but I needed to install CUPS on my OMV5 (OpenMediaVault 5) server, and your instructions were great.

My setup is not a RPi, but on an old HP server so I used olbat/cupsd from the site below, and now cups is up & running in my portainer.

Thanks again for this, you are awesome.

https://hub.docker.com/r/olbat/cupsd

Hi, i configured cup using Portainer on my pi 4 with Hassos… The problem now is that using Hassos 4.20 it works fine, but upgrading to Hassos 5.9 the server still works, but no printer is shown on the net. Which is the problem? What I have to do to share the printer added in cups docker? please help me, thanks.

Try to update cups with the container ydkn/cups

I tried to format all, installing hassio 5.9, then install container with cups, but nothing

This is a well laid out guide but i am having problems deploying it. When I press deploy container i get this error message.

Failure

driver failed programming external connectivity on endpoint CUPS (6bbdd8d98de77c1deee0c46b696309beead6083910a576feab8f9debb04d1501): Error starting userland proxy: listen tcp4 0.0.0.0:631: bind: address already in use

Any ideas on how to fix this,
Thankyou

1 Like

Is this setup working with current version of home assistant?

I successfully set up this but what is the default password for cups? when I try to add printer it asks for a username and password. I have tried root and root, Root and my homeassistant password combination but still no luck

https://hub.docker.com/r/olbat/cupsd

Hint:
Note: The admin user/password for the Cups server is print/print

:+1:

3 Likes

I found it after extensive googling around but thanks. this will help new users.

Thank you for this. While I didn’t set up a USB printer on my Home Assistant box, I did on my NAS/Media server running docker/portainer & found your instructions very helpful. Thank you again.

got the same problem. some how the 631 is used from the home assistant container. I tried 49631 for the host port, and I can access to the page via localhost:49631 and add my Canon printer. haven’t find a way to see the printer from port 49631. :frowning_face:

Thanks for your great guide, managed to install it successfully but now fail to install the printer.
Found PPD file for my printer, it istals. But when trying to print get the error:
Idle - “File “/usr/lib/cups/filter/RICOH_SP_150Filter.app” not available: No such file or directory”
Do have this file on my local PC but have no idea how to upload it to this directory - ha file browser do not see it, FTP as well. Any advice?

I have a same problem with printer Ricoh SP211 :frowning:
If someone has some idea, please help us :wink:

To everyone who came here to learn how to add CUPS functionality to HASS: The portainer add-on has been discontinued and is no longer available in the add-on store. :frowning:

Whilst this is true, I managed to get it working by forking the home assistant community addon repo and reverting it to before it was removed. I then added it as a custom repo in home assistant and managed to install it.

3 Likes

That’s exactly what I was looking for! I did everything from your Tutorial but somehow I can’t connect to the http://localhassip:631 adress. It just says that the URL isn’t reachable… I did everything from my Desktop PC. Do I have to do the setup from the Pi directly? Or did I something other wrong.

Iam new to HA so I hope you can help me :slight_smile:

It says no Port published, is that normal?

Hi @Squall40,

I got here from another post about automations.
It looks like you don’t have any published ports in your container.
Try the following using portainer:
Click on the Container Name (rpi-cups)
Then click on Duplicate/Edit
Under Port Mapping, click on + Map Additional Port and add 631 to Host and 631 to Container


And click on “Deploy the Container”
This will restart the container with the port 631 mapped.

Thanks for responding!

I had the correct settings already applied but the port doesnt show as published. So i tried it again and somehow the port was shown as published…for a few seconds and then it disappeared again oO Not sure what this means ><

after reloading the page or simply waiting a few seconds, it disapears…

Should i try another a different container?

Hi @Squall40 ,

I’m not sure what is happening with the ports.
Can you check the container logs? (Under Quick Actions, click on the 1st option in the left)

if there is nothing there, maybe the port 631 is already being used and the container cannot bind to the port.
Try changing in Host Port to something like 6631 (and keep the same port 631 under Container)