Created
July 8, 2020 13:29
-
-
Save ictus4u/3616c9cacab452426e0e536272c54561 to your computer and use it in GitHub Desktop.
Dockerfile snippets
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
ARG USERNAME=user-name-goes-here | |
ARG USER_UID=1000 | |
ARG USER_GID=$USER_UID | |
# Create the user | |
RUN groupadd --gid $USER_GID $USERNAME \ | |
&& useradd --uid $USER_UID --gid $USER_GID -m $USERNAME \ | |
# | |
# [Optional] Add sudo support. Omit if you don't need to install software after connecting. | |
&& apt-get update \ | |
&& apt-get install -y sudo \ | |
&& echo $USERNAME ALL=\(root\) NOPASSWD:ALL > /etc/sudoers.d/$USERNAME \ | |
&& chmod 0440 /etc/sudoers.d/$USERNAME | |
# ******************************************************** | |
# * Anything else you want to do like clean up goes here * | |
# ******************************************************** | |
# [Optional] Set the default user. Omit if you want to keep the default as root. | |
USER $USERNAME |
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
# Configure apt | |
ENV DEBIAN_FRONTEND=noninteractive | |
RUN apt-get update \ | |
&& apt-get -y install --no-install-recommends apt-utils dialog 2>&1 | |
## YOUR DOCKERFILE CONTENT GOES HERE | |
ENV DEBIAN_FRONTEND=dialog |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment