CUPS client cannot print when providing the CUPS server as container name, while it works fine with the container IP:
Sample docker-compose.yml
:
version: '3.7'
services:
client:
container_name: cups_client
image: cups_client
server:
container_name: cups_server
image: cups_server
The client container's /etc/cups/client.conf
uses the name of the server container:
ServerName cups_server
However, this configuration does not work properly (run inside client container):
$ lpstat -r
scheduler is running
$ lpstat -v
lpstat: Error - add '/version=1.1' to server name.
I tried to add '/version=1.1' to the server name in /etc/cups/client.conf
, but the error still shows.
However, if I use the server container's IP address in /etc/cups/client.conf
, printing works just fine:
ServerName 172.27.0.2
See difference in lpstat -v
:
$ lpstat -r
scheduler is running
$ lpstat -v
device for queue_name: ipp://192.168.0.10/ipp/port1
Name resolution seems to work fine in the client container however:
$ getent hosts cups_server
172.27.0.2 cups_server
Now using the IP is not really an option, as the printing configuration is provided during build time already, when the IP is not yet known. Also in my understanding CUPS should work just fine with the container name.
Grateful for any idea how to solve this, or why cups would not get along with the container name.