Code Monkey home page Code Monkey logo

cups-airprint's Introduction

Archived

No further updates to the repository will be made at this time. Please see the forks for any possible solutions to your specific use case and/or the author-suggested repo at: https://github.com/chuckcharlie/cups-avahi-airprint.

Table of Contents

Modified copy of source code at: https://github.com/quadportnick/docker-cups-airprint

This Ubuntu-based Docker image runs a CUPS instance that is meant as an AirPrint relay for printers that are already on the network but not AirPrint capable. The local Avahi will be utilized for advertising the printers on the network.

The below commands reference a Docker Manifest List at ghcr.io/ragingtiger/cups-airprint:master built using Docker's BuildKit. Simply running commands using this image will pull the matching image architecture (e.g. amd64, arm32v7, or arm64) based on the hosts architecture. Hence, if you are on a Raspberry Pi the below commands will work the same as if you were on a traditional amd64 desktop/laptop computer. Note: Because the image requires ubuntu as its base image, there is currently no arm32v6 architecture available. This means if your target hardware is a Raspberry Pi Zero or similar arm 6 architecture, this image will not run.

This section will give an overview of the essential options/arguments to pass to docker to successfully run containers from the ghcr.io/ragingtiger/cups-airprint:master docker image.

To simply do a quick and dirty run of the cups/airprint container:

docker run \
       -d \
       --name=cups \
       --net=host \
       -v /var/run/dbus:/var/run/dbus \
       --device /dev/bus \
       --device /dev/usb \
       -e CUPSADMIN="admin" \
       -e CUPSPASSWORD="password" \
       ghcr.io/ragingtiger/cups-airprint:master

To stop the container simply run:

docker stop cups

To remove the conainer simply run:

docker rm cups

WARNING: Be aware that deleting the container (i.e. cups in the example) will permanently delete the data that docker volume is storing for you. If you want to permanently persist this data, see the docker create example below. Continue reading the Notes section for more details about Docker volumes

  • Notes: The Dockerfile explicitly sets volumes at /config and /services (see these lines). The necessary configurations done by the docker container will be stored in those directories and will persist even if the container stops. Docker will store the contents of these directories (located in the container) in /var/lib/docker/volumes (see for reference Docker Volumes).

Creating a container is often more desirable than directly running it:

docker create \
       --name=cups \
       --restart=always \
       --net=host \
       -v /var/run/dbus:/var/run/dbus \
       -v ~/airprint_data/config:/config \
       -v ~/airprint_data/services:/services \
       --device /dev/bus \
       --device /dev/usb \
       -e CUPSADMIN="admin" \
       -e CUPSPASSWORD="password" \
       ghcr.io/ragingtiger/cups-airprint:master

Follow this with docker start and your cups/airprint printer is running:

docker start cups

To stop the container simply run:

docker stop cups

To remove the conainer simply run:

docker rm cups
  • Notes: As mentioned in the Notes subsection of the Run section, the Dockerfile explicitly declares two volumes at /config and /services inside the container as mount points. Here we actually override the default use of Docker's innate volume management system and declare our own path on the host system to mount the two directories /config and /services. Why? Because now if the container is deleted (for any number of reason ...) the data will persist. Here we chose to mount the internal /config and /services directories to ~/airprint_data/config and ~/airprint_data/services respectively, but these could just as well be anywhere on your file system.
  • --name: gives the container a name making it easier to work with/on (e.g. cups)
  • --restart: restart policy for how to handle restarts (e.g. always restart)
  • --net: network to join (e.g. the host network)
  • -v ~/airprint_data/config:/config: where the persistent printer configs will be stored
  • -v ~/airprint_data/services:/services: where the Avahi service files will be generated
  • -e CUPSADMIN: the CUPS admin user you want created
  • -e CUPSPASSWORD: the password for the CUPS admin user
  • --device /dev/bus: device mounted for interacting with USB printers
  • --device /dev/usb: device mounted for interacting with USB printers

If you don't want to type out these long Docker commands, you could optionally use docker-compose to set up your image. Just download the repo and run it like so:

git clone https://github.com/RagingTiger/docker-cups-airprint
cd docker-cups-airprint
docker-compose up

NOTE: This compose file is made with USB printers in mind and like the above commands has device mounts for USB printers. If you don't have a USB printer you may want to comment these out. Also the config/services data will be saved to the users $HOME directory. Again you may want to edit this to your own liking.

If you would like to build the image yourself (locally), pull down the repo and run the docker build command as follows:

git clone https://github.com/RagingTiger/docker-cups-airprint
cd docker-cups-airprint
docker build -t tigerj/cups-airprint .

Follow this with a docker run or docker create to deploy your container and your cups-airprint server is ready to be configured and used.

CUPS will be configurable at http://localhost:631 using the CUPSADMIN/CUPSPASSWORD when you do something administrative.

If the /services volume isn't mapping to /etc/avahi/services then you will have to manually copy the .service files to that path at the command line.

  • CUPS doesn't write out printers.conf immediately when making changes even though they're live in CUPS. Therefore it will take a few moments before the services files update
  • Don't stop the container immediately if you intend to have a persistent configuration for this same reason

Here we are going to discuss the most common problems that users have when trying to setup and configure their printer to work with the tigerj/cups-airprint image.

As you might imagine this is the most common problem users have when setting up their printers. While the tigerj/cups-airprint image possesses multiple printer drivers, it most likely does not have every driver for every printer. This issue can be resolved as follows:

  • Figure out what printer driver you need, open an issue about missing driver, necessary package containing said driver will be added to Dockerfile.

Sometimes the right printer driver is installed in the tigerj/cups-airprint Docker image, but the version is not current. This issue may require one of two choices to resolve:

  • Download the docker-cups-airprint git repo and build a fresh image

    • This will pull the most recent versions of the printer driver from the package manager.
  • Download driver DIRECTLY from the manufacturer and add it to the image

    • If building a fresh image does not update the version of the driver, then you will need the most recent printer driver from the manufacturer.

cups-airprint's People

Contributors

marchanlon avatar ragingtiger avatar webhdx avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

cups-airprint's Issues

Lexmark X9575

Hi

Can you install the Lexmark X9575 drivers into the package?

Missing Printer Driver Brother MFC-7460DN

hey, I read in the last issue that the repo Brlaser is added. The Brother MFC-7460DN printer is also part of the repo. Unfortunately I cannot find or add the printer in the drop-down menu. What am I doing wrong? Thanks

brother printer drives

Could you please add the printer-driver-brlaser from this repo to the docker file? This would add support for more brother laser printers. ๐Ÿ˜„

Printer HP problem

I could add the printer HP Laser 107a using ppd file OK after download and install the driver for Pi. But the printer status is:
File "/usr/lib/cups/filter/rastertospl" not available: No such file or directory
I tried to create the directories then copy the file rastertospl but same problem even after restart cups. Try to print a test page fail. Got forbidden when view the log.

hp plugin

I setup a HP_M126a, and suffer "Filter failed".
need to be installed hp plugin.
but while I execute the command, looks no connection.
how can i process?

| DOWNLOAD PLUGIN |

Checking for network connection... Downloading plug-in from:
Downloading plug-in: [\ ] 0% -^Cerror: User exit

Enable AirPrint

Hey, I've installed this container using docker-compose (ubuntu) and am able to access cups and print the test page from the GUI.
However I use the print function on my iOS device, it can't find the printer, is there a way to enable this or should it be enabled by default?

Once the container starts I move the .service file from /services to /etc/avahi/services and then restart the container.

Print jobs stuck - Failed to open PPD: /etc/cups/ppd/OfficePrinter.ppdk

Is there something additional that needs to be done?
Every job gets stuck in the queue with the error: Failed to open PPD: /etc/cups/ppd/OfficePrinter.ppd

Printer details:

Queue Name | Description | Location | Make and Model | Status
-- | -- | -- | -- | --
OfficePrinter | EPSON Artisan 830 | 8455 Office | Epson Artisan 835 - CUPS+Gutenprint v5.2.11 | Processing - "Unable to locate printer "FRPEPSON835.local"."

I configured my printer just fine (Epson Artisan 835) from the web interface and I see the printer in .../config/printers.conf along with the .../config/ppd/OfficePrinter.ppd and OfficePrinter.ppd.0 files

[/share/docker/cups-data/config] # docker exec -i -t cups ls -al /etc/cups/ppd  
lrwxrwxrwx 1 root root 11 Jan 23 17:55 /etc/cups/ppd -> /config/ppd

[/share/docker/cups-data/config] # docker exec -i -t cups ls -al /config/ppd  
total 400
drwxrwx---+ 2 root root   4096 Jan 23 17:59 .
drwxrwx---+ 3 root root   4096 Jan 23 17:55 ..
-rw-r-----+ 1 root lp   193984 Jan 23 17:59 OfficePrinter.ppd
-rw-r-----+ 1 root lp   193957 Jan 23 17:58 OfficePrinter.ppd.O

The printer shows up in AirPrint and queues jobs just fine.

How do I fix this please?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.