Can not add new user in docker container with mounted /etc/passwd and /etc/shadow
Example of the problem: docker run -ti -v my_passwd:/etc/passwd -v my_shadow:/etc/shadow --rm centos [root@681a5489f3b0 /]# useradd test # does not work !? useradd: failure while writing changes to /etc/passwd [root@681a5489f3b0 /]# ll /etc/passwd /etc/shadow # permission check -rw-r--r-- 1 root root 157 Oct 8 10:17 /etc/passwd -rw-r----- 1 root root 100 Oct 7 18:02 /etc/shadow The similar problem arises when using passwd: [root@681a5489f3b0 /]# passwd test Changing password for user test. New password: BAD PASSWORD: The password is shorter than 8 characters Retype new password: passwd: