Skip to content

Instantly share code, notes, and snippets.

@Fedcomp
Last active March 30, 2019 12:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Fedcomp/c2b3d5ebea1734b42637c809df099283 to your computer and use it in GitHub Desktop.
Save Fedcomp/c2b3d5ebea1734b42637c809df099283 to your computer and use it in GitHub Desktop.
Create docker image with non-root user
USER_ID=1000
version: '3'
services:
web:
build:
context: .
dockerfile: docker/dev/web/Dockerfile
args:
APP_USER_ID: $USER_ID
FROM something
# linux user id for application files
ARG APP_USER_ID
# create app user
RUN useradd -d /app -u $APP_USER_ID app
USER app
WORKDIR /app
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment