Last active
June 12, 2024 16:15
-
-
Save kgsnipes/fab13b4fad9653f70a3de34a93dd17eb to your computer and use it in GitHub Desktop.
adding user to user group and switching to user on docker
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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