0

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.

rks101
  • 1
  • 2

1 Answers1

0

Turns out it was a CUPS server config issue.

CUPS server logs in /var/log/cups/error_log:

Request from "172.27.0.3" using invalid Host: field "cups-server:631".

Solution:

Add ServerAlias cups-server in /etc/cups/cupsd.conf

rks101
  • 1
  • 2