How to run CUPS in docker?

Viewed 21

I want to run cups in docker.

My Dockerfile:

ARG LIB_VERSION
FROM buffer-connectors-base:"${LIB_VERSION}"
WORKDIR /app
RUN apt-get update
RUN apt-get install cups -y
COPY app/requirements.txt ./requirements.txt
RUN pip --no-cache-dir install -r requirements.txt
COPY app/ .
CMD cupsd

If I try sent lpstat -p in image, I receive:

root@021034ef2cda:/app# lpstat -p
lpstat: Bad file descriptor

If I run cups directly in image, it works!

root@021034ef2cda:/app# cupsd
root@021034ef2cda:/app# lpstat -p
lpstat: No destinations added.

After this I can install printer

root@021034ef2cda:/app# lpadmin -p HP-TEST -E -v ipp://192.168.18.193 -m everywhere
root@021034ef2cda:/app# lpstat -p
printer HP-TEST is idle.  enabled since Tue Sep 20 13:51:58 2022

How do I write the instruction to run cups in Dockerfile correctly?

0 Answers
Related