With the influx of GUI applications being ported to docker, what is the best way to print to cups from inside a docker container?
NB: I am not looking to run cups from inside the container as this breaks the single service paradigm associated with docker.
Differences between CMD & ENTRYPOINT CMD commands are ignored by Daemon when there are parameters stated within the docker run command while ENTRYPOINT instructions are not ignored but instead are appended as command line parameters by treating those as arguments of the command.
Developing inside a Docker container generally means starting a container and leaving it running, while you edit your source code. As you make changes, you see the changes appear in the container. To get your source code inside a container, you can use something called a bind mount.
Multiple containers can run simultaneously, each based on the same or different images. Docker is similar to virtual machines in the way it creates multiple instances of an operating system.
You can use Docker to run a Java application in a container with a specific runtime environment.
Self Documenting after investigation work on how to achieve this goal.
Mounting in the cups socket worked great...ish (acroread failed to populate printers) with an Ubuntu based docker host, however this failed with a Redhat host.
...
-v /var/run/cups:/var/run/cups:ro
...
Populating the cups client.conf appeared to be a better 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 the docker launch argument:
...
-v /tmp/client.conf:/etc/cups/client.conf:ro \
...
I also had to ensure the cups server would bind to the docker0 bridge and allow other devices to access the cups server:
...
Listen *:631
...
<Location />
Order allow,deny
Allow all
</Location>
...
Once cups had restarted and the cups client.conf passed into the container I was able to print as expected.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With