Search
 
SCRIPT & CODE EXAMPLE
 

SHELL

how to set user in dockerfile

RUN useradd -ms /bin/bash newuser

USER newuser
WORKDIR /home/newuser
Comment

add user to dockerfile

# Create the user
ARG USER_ID=1005
ARG GROUP_ID=1006
ARG USERNAME=<user_name>
RUN groupadd --gid $GROUP_ID $USERNAME 
    && useradd --uid $USER_ID --gid $GROUP_ID -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

USER $USERNAME

# OR TLDR

RUN groupadd -r <group> && useradd --no-log-init -r -g <group> <user>
USER <user>
Comment

PREVIOUS NEXT
Code Example
Shell :: run mongodb on desktop 
Shell :: no matching key exchange method found. Their offer: diffie-hellman-group14-sha1,diffie-hellman-group1-sha1 
Shell :: install chocolatey 
Shell :: linux check if using wayland or x11 
Shell :: django install pathlib 
Shell :: how to add directory path to path variable ubuntu 
Shell :: git-hub push code 
Shell :: github download specific folder 
Shell :: undo a git merge 
Shell :: linux back cd 
Shell :: creating a branch in git 
Shell :: git revert to commit 
Shell :: powershell get all directories in path 
Shell :: git change branch remote 
Shell :: how to install jupyter in excel 
Shell :: bash find file in directory 
Shell :: install packages from txt 
Shell :: uninstall dependency npm 
Shell :: curl test https 
Shell :: how to WSL2 
Shell :: kubernetes on windows 10 
Shell :: create branch based to other branch ex. master 
Shell :: install packages from pipfile 
Shell :: install grammarly on mac brew 
Shell :: split string using linux cmd 
Shell :: can i install linux on an external hard drive 
Shell :: gtk windows install 
Shell :: vim count ocurrences 
Shell :: how to remove windows 10 built in apps powershell 
Shell :: chkconfig: command not found 
ADD CONTENT
Topic
Content
Source link
Name
5+6 =