Printing from inside a docker container

When the influx of GUI applications is transferred to docker, what is the best way to print into cups from a docker container?

NB: I do not want to run cups from the inside of the container, as this violates the only service paradigm associated with docker.

+5
source share
1 answer

Independent documentation after an investigation on how to achieve this goal.

Installing the cup nest worked fine ... ish (acroread could not fill the printers) using the Ubuntu-based docker node, however this failed with the Redhat host.

... -v /var/run/cups:/var/run/cups:ro ... 

Filling the client.conf cups turned out to be the best solution.

 cat /tmp/client.conf #The ServerName directive specifies sets the remote server # that is to be used for all client operations. That is, it # redirects all client requests to the remote server. The # default port number is 631 but can be overridden by adding # a colon followed by the desired port number to the value. # The default is to use the local server ("localhost"). ServerName <DOCKER0 BRIDGE IP> 

and docker launch argument:

 ... -v /tmp/client.conf:/etc/cups/client.conf:ro \ ... 

I also had to ensure that the cup server binds to the docker0 bridge and allows other devices to access the cup server:

 ... Listen *:631 ... <Location /> Order allow,deny Allow all </Location> ... 

As soon as the cups restarted and the client.conf cups went into the container, I was able to print as expected.

+5
source

All Articles