Skip to content

Instantly share code, notes, and snippets.

@l1x
Last active May 14, 2021
Embed
What would you like to do?

➜ rpi4-3.lan ui git:(main) ✗ cat docker/base/Dockerfile

FROM debian:bullseye-slim
RUN DEBIAN_FRONTEND=noninteractive apt-get clean && apt-get update \
&& apt install apt-utils && apt-get install doas -y

RUN useradd -m -u 5000 -s /sbin/nologin app || :
RUN useradd -m -u 5001 -s /bin/bash admin || :
RUN echo 'permit nopass admin as root' > /etc/doas.conf

➜ rpi4-3.lan ui git:(main) ✗ docker build . -t local/artasearch:ui-base-202105 --file docker/base/Dockerfile

➜ rpi4-3.lan ui git:(main) ✗ cat Dockerfile

FROM local/artasearch:ui-base-202105
USER admin
RUN doas id
USER app
RUN id

➜ rpi4-3.lan ui git:(main) ✗ docker build . -t local/artasearch:ui-202105 --file Dockerfile

Result:

Sending build context to Docker daemon  4.608kB
Step 1/5 : FROM local/artasearch:ui-base-202105
 ---> 4997133b9f47
Step 2/5 : USER admin
 ---> Running in de2c2620ab9a
Removing intermediate container de2c2620ab9a
 ---> 3ede93fd65b0
Step 3/5 : RUN doas id
 ---> Running in b1fe42f4c773
uid=0(root) gid=0(root) groups=0(root)
Removing intermediate container b1fe42f4c773
 ---> 1e25201eaecf
Step 4/5 : USER app
 ---> Running in 6dcdbcf6bf0d
Removing intermediate container 6dcdbcf6bf0d
 ---> a938bd81f81a
Step 5/5 : RUN id
 ---> Running in ed1d5837b64d
uid=5000(app) gid=5000(app) groups=5000(app)
Removing intermediate container ed1d5837b64d
 ---> d3a202d29f84
Successfully built d3a202d29f84
Successfully tagged local/artasearch:ui-202105
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment