docker
Folders and files
Name | Name | Last commit date | ||
---|---|---|---|---|
parent directory.. | ||||
For creating a production docker image an account should be added to prevent using root for everything by default. This can be accomplished by adding the following lines in the Dockerfile. ``` # Set up a user `developer` with sudo rights RUN export uid=1000 gid=1000 && \ mkdir -p /home/developer && \ mkdir -p /etc/sudoers.d/ && \ echo "developer:x:${uid}:${gid}:Developer,,,:/home/developer:/bin/bash" >> /etc/passwd && \ echo "developer:x:${uid}:" >> /etc/group && \ echo "developer ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers.d/developer && \ chmod 0440 /etc/sudoers.d/developer && \ chown ${uid}:${gid} -R /home/developer USER developer ENV HOME /home/developer ```