Created
November 26, 2019 22:55
-
-
Save jomoespe/168b0baf7ba45c84215b35cad886d0d1 to your computer and use it in GitHub Desktop.
Non-privileged Docker image from scratch
This file contains hidden or 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
# Non-privileged containers based on the scratch image | |
# https://medium.com/@lizrice/non-privileged-containers-based-on-the-scratch-image-a80105d6d341 | |
FROM ubuntu AS base | |
RUN useradd -u 10001 user | |
RUN mkdir /home/user | |
FROM scratch | |
COPY --from=base /etc/passwd /etc/passwd | |
COPY --from=base /home/user /home/user | |
USER user | |
ADD app / | |
ENTRYPOINT [ "/app" ] | |
# How to build the container | |
# docker build -t app . | |
# | |
# How to run: | |
# docker build -t app . | |
# | |
# Also you can create an alias, passing aws credentials: | |
# alias the-app="docker run --rm -ti -v $(HOME)/.aws/credentials:/home/app/.aws/credentials:ro app" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment