


Default password argument is not encrypted.Person_B with user id other than 1000, for instance 1001, cannot use the image built by person_A. The image is dependent on user id means, this image only works for users who have the same uid on different hosts.Colorful bash prompt since adduser -m created a home directory, there is a.In this method we install and add a new user to sudo and pass the arguments from command line when building the docker image. It might show that UID is a read-only variable. LinkĮxport UID=$(id -u) export GID=$(id -g) docker run -it \ -user $UID:$GID \ -workdir="/home/$USER" \ -volume="/etc/group:/etc/group:ro" \ -volume="/etc/passwd:/etc/passwd:ro" \ -volume="/etc/shadow:/etc/shadow:ro" \ /bin/bash Or you can add the bash script to enable colorful prompt. bashrc file, which results in mono bash prompt. bashrc is not in workdir Since you didn’t create a user inside the image if you don’t mount your home directory as workdir inside the container, there will be no. The image is independent to user id means, the image is valid for everyone.No extra work to change the existing system or images.In this method, we mount/overwrite the files related to password and user accounts from host to container. When operating files in the volume from container and host, it often results in some problems due to ownership of files. When developing inside a container, sometimes it is problematic that you create a file which will be owned by root and not able to be operated with host user, unless the host user runs the command with sudo privileges. Please consider whether there is safty issue in your application. Warning If you ues non-user with the same uid as current host user and mount a host volume, it means the data inside host volume is visible by host and can be operated by both host user and user in container because both user have same authority. Remember to substitute all variables with uppercase with angle bracket. I personally prefer to use docker-compose to mount all host password related files to the container. Set current host user for docker containerĮnv: ubuntu 18.04, Docker 18.09.4, Docker-compose 1.23.2 TL DR
