Skip to content

Commit

Permalink
Set UID and GUID of the user inside Docker container to 1000
Browse files Browse the repository at this point in the history
Should increase chances to match host user's UID, allowing write access to mounted volumes.
  • Loading branch information
user committed Dec 21, 2024
1 parent dd2879d commit 2c21178
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
8 changes: 5 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
FROM jrottenberg/ffmpeg:7.1-ubuntu as base

RUN useradd -m -U avtdl
RUN userdel -f ubuntu
RUN groupadd -f -g 1000 avtdl
RUN useradd -m -u 1000 -g 1000 -o avtdl
RUN apt-get update
RUN apt-get install -y --no-install-recommends --no-install-suggests python3 ca-certificates
ENV PATH=/home/avtdl/.local/bin:$PATH
Expand All @@ -12,7 +14,7 @@ RUN apt-get install -y --no-install-recommends --no-install-suggests git pipx wg

WORKDIR /home/avtdl/build
COPY ./ ./
RUN chown avtdl:avtdl -R /home/avtdl
RUN chown 1000:1000 -R /home/avtdl

USER avtdl
RUN pipx install .
Expand All @@ -27,7 +29,7 @@ FROM base as app
WORKDIR /home/avtdl/app

COPY --from=build /home/avtdl/.local /home/avtdl/.local
RUN chown avtdl:avtdl -R /home/avtdl
RUN chown 1000:1000 -R /home/avtdl

USER avtdl

Expand Down
7 changes: 4 additions & 3 deletions Dockerfile-basic
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
FROM debian:stable-slim as base

RUN useradd -m -U avtdl
RUN groupadd -f -g 1000 avtdl
RUN useradd -m -u 1000 -g 1000 -o avtdl
RUN apt-get update
RUN apt-get install -y --no-install-recommends --no-install-suggests python3 ca-certificates
ENV PATH=/home/avtdl/.local/bin:$PATH
Expand All @@ -12,7 +13,7 @@ RUN apt-get install -y --no-install-recommends --no-install-suggests git pipx

WORKDIR /home/avtdl/build
COPY ./ ./
RUN chown avtdl:avtdl -R /home/avtdl
RUN chown 1000:1000 -R /home/avtdl

USER avtdl
RUN pipx install .
Expand All @@ -23,7 +24,7 @@ FROM base as app
WORKDIR /home/avtdl/app

COPY --from=build /home/avtdl/.local /home/avtdl/.local
RUN chown avtdl:avtdl -R /home/avtdl
RUN chown 1000:1000 -R /home/avtdl

USER avtdl

Expand Down

0 comments on commit 2c21178

Please sign in to comment.