1

For an application I'm currently developing I'm trying to integrate CUPS as a printing server.

Since I want to deploy everything using docker I'm configuring a docker-compose file that spins up the web application and the cups server instance.

THE GOAL

I want to save the CUPS configurations store in the container /etc/cups directory on the host machine so that if I stop the container and update the image I don't loose all the printers I already configured on the CUPS server.

THE CONFIGURATION

The first configuration I tried was the following one:

version: '3.8'
services:
  ...
  cups:
    image: cups_image
    ports:
      - ...
    volumes:
      - scriba-cups:/etc/cups
volumes:
  scriba-cups:

Everything works fine and if I check the volume I can see the configuration files are correctly stored inside it.

THE PROBLEM

Since the web application uses a bind mount directory to store other type of data I actually wanted to standardize the configuration of CUPS too and use a simple bind mount.

The configuration I tried was the following one:

version: '3.8'
services:
  ...
  cups:
    image: cups_image
    ports:
      - ...
    volumes:
      - type: bind
        source: D:\...\cups\
        target: /etc/cups

With this configuration the CUPS container doesn't start at all probably because it can't bind to the target directory.

I checked the /etc/cups directory and the permissions were set to 755 so I decided to try and run a chmod -R 777 /etc/cups before running cups with the command cups -f but the container did not start anyways.

The problem I think is due to the fact that once cups starts it changes the permission back to 755.

I tried some other tricks and managed to change the permissions and spin up cups but I have other errors (I can't access the CUPS web interface anymore and I should elaborate more on that if I want to continue on this path)

THE QUESTIONS

  1. Is it possible to bind mount to a directory which has 755 permission on it?
  2. Is there a way to tell CUPS to apply 777 permissions on the /etc/cups directory?
  3. Is there any other way to configure the bind mount to /etc/cups?
  • What's the actual error you're getting? So long as the program can read the config directory I'd expect it to start up; I would not normally expect write permissions to matter on a `/etc` directory, nor would I expect a server to try to change it. – David Maze Oct 14 '21 at 09:50

0 Answers0