Skip to content

Instantly share code, notes, and snippets.

@Aposhian
Created June 2, 2022 19:25
Show Gist options
  • Save Aposhian/ae410b153ebabf69ddd38ae99c4466b5 to your computer and use it in GitHub Desktop.
Save Aposhian/ae410b153ebabf69ddd38ae99c4466b5 to your computer and use it in GitHub Desktop.
Run as user inside of Dockerfile
#!/usr/bin/env bash
docker build . --build-arg UID=$(id -u) --build-arg GID=$(id -g)
FROM debian
ARG UID
ARG GID
RUN groupadd -g ${GID} me
RUN useradd -g ${GID} -u ${UID} me
USER ${UID}:${GID}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment