fix: web access over FQDN instead localhost
This commit is contained in:
parent
15a90b1324
commit
68fe1931db
12
Dockerfile
12
Dockerfile
@ -4,11 +4,6 @@ FROM ubuntu:18.04
|
||||
# Environment
|
||||
ENV CUPS_ADMIN_USER=print
|
||||
ENV CUPS_ADMIN_PASSWD=print
|
||||
|
||||
# Labels
|
||||
LABEL maintainer="Markus Pesch"
|
||||
|
||||
# Non-Interactive
|
||||
ENV DEBIAN_FRONTEND="noninteractive"
|
||||
|
||||
# Software installation
|
||||
@ -28,7 +23,12 @@ RUN apt-get update && \
|
||||
hplip && \
|
||||
rm -rf /var/lib/apt/lists/*
|
||||
|
||||
COPY install-scripts /tmp/install-scripts
|
||||
RUN for i in /tmp/install-scripts/*; do sh $i; done
|
||||
|
||||
# https://www.cups.org/doc/firewalls.html
|
||||
EXPOSE 631
|
||||
|
||||
COPY entrypoint.sh /usr/local/bin/entrypoint.sh
|
||||
RUN chmod +x /usr/local/bin/entrypoint.sh
|
||||
|
||||
ENTRYPOINT [ "/usr/local/bin/entrypoint.sh"]
|
2
Makefile
2
Makefile
@ -13,4 +13,4 @@ build:
|
||||
|
||||
push: build
|
||||
docker login --username ${DOCKER_USER} --password ${DOCKER_PASSWORD}
|
||||
docker push ${DOCKER_USER}/cupsd:${VERSION}
|
||||
docker push ${DOCKER_USER}/cupsd:${VERSION}
|
11
README.md
11
README.md
@ -13,11 +13,12 @@ docker run \
|
||||
--detach \
|
||||
--env CUPS_ADMIN_USER=print \
|
||||
--env CUPS_ADMIN_PASSWD=print \
|
||||
--network=host \
|
||||
--volume /var/run/dbus:/var/run/dbus \
|
||||
--name cupsd \
|
||||
--publish 631:631 \
|
||||
--volume /var/run/dbus:/var/run/dbus \
|
||||
volkerraschek/cupsd
|
||||
```
|
||||
--network=host \
|
||||
|
||||
or if you want to use a `docker-compose.yml`
|
||||
|
||||
@ -29,10 +30,12 @@ services:
|
||||
environment:
|
||||
- CUPS_ADMIN_USER=print
|
||||
- CUPS_ADMIN_PASSWD=print
|
||||
network_mode: host
|
||||
image: volkerraschek/cupsd
|
||||
ports:
|
||||
- 631:631
|
||||
restart: always
|
||||
volumes:
|
||||
- /var/run/dbus:/var/run/dbus
|
||||
```
|
||||
|
||||
After starting the container, cups is available over http://localhost:631
|
||||
After starting the container, cups is available over http://localhost:631 or over your FQDN.
|
||||
|
11
entrypoint.sh
Normal file → Executable file
11
entrypoint.sh
Normal file → Executable file
@ -1,14 +1,3 @@
|
||||
#!/bin/bash
|
||||
|
||||
useradd \
|
||||
--groups=sudo,lp,lpadmin \
|
||||
--create-home \
|
||||
--home-dir=/home/${CUPS_ADMIN_USER} \
|
||||
--shell=/bin/bash \
|
||||
${CUPS_ADMIN_USER}
|
||||
|
||||
echo "${CUPS_ADMIN_USER}:${CUPS_ADMIN_PASSWD}" | chpasswd
|
||||
|
||||
sed --in-place '/%sudo[[:space:]]/ s/ALL[[:space:]]*$/NOPASSWD:ALL/' /etc/sudoers
|
||||
|
||||
/usr/sbin/cupsd -f
|
10
install-scripts/00_cupsd.sh
Normal file
10
install-scripts/00_cupsd.sh
Normal file
@ -0,0 +1,10 @@
|
||||
#/bin/bash
|
||||
|
||||
/usr/sbin/cupsd
|
||||
while [ ! -f /var/run/cups/cupsd.pid ]; do
|
||||
sleep 1
|
||||
done
|
||||
cupsctl --remote-admin --remote-any --share-printers
|
||||
kill $(cat /var/run/cups/cupsd.pid)
|
||||
|
||||
echo "ServerAlias *" >> /etc/cups/cupsd.conf
|
14
install-scripts/01_user.sh
Normal file
14
install-scripts/01_user.sh
Normal file
@ -0,0 +1,14 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
|
||||
useradd \
|
||||
--groups=sudo,lp,lpadmin \
|
||||
--create-home \
|
||||
--home-dir=/home/${CUPS_ADMIN_USER} \
|
||||
--shell=/bin/bash \
|
||||
${CUPS_ADMIN_USER}
|
||||
|
||||
echo "${CUPS_ADMIN_USER}:${CUPS_ADMIN_PASSWD}" | chpasswd
|
||||
|
||||
sed --in-place '/%sudo[[:space:]]/ s/ALL[[:space:]]*$/NOPASSWD:ALL/' /etc/sudoers
|
Loading…
Reference in New Issue
Block a user