Skip to content

Instantly share code, notes, and snippets.

@kgsnipes
Last active June 12, 2024 16:15
Show Gist options
  • Save kgsnipes/fab13b4fad9653f70a3de34a93dd17eb to your computer and use it in GitHub Desktop.
Save kgsnipes/fab13b4fad9653f70a3de34a93dd17eb to your computer and use it in GitHub Desktop.
adding user to user group and switching to user on docker
FROM ubuntu:latest
RUN apt-get -y update
RUN groupadd -r usergroup && useradd -r -g usergroup user
USER user
------
https://medium.com/redbubble/running-a-docker-container-as-a-non-root-user-7d2e00f8ee15
-----
docker container run --rm -it \
-v $(app):/app \ # Mount the source code
--workdir /app \ # Set the working dir
--user 1000:1000 \ # Run as the given user
my-docker/my-build-environment:latest \ # Our build env image
make assets
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment