linux - How to write the docker script such that sudo works in Docker user? -
i've ran empty docker container ubuntu , created sudo
user such:
user@server$ docker run -it ubuntu bash root@6da1c5bc7f93:/# apt-get update root@6da1c5bc7f93:/# apt-get -y install sudo root@6da1c5bc7f93:/# useradd -m -p mosesdocker -s /bin/bash ubiwan root@6da1c5bc7f93:/# usermod -ag sudo ubiwan # add user sudo list root@6da1c5bc7f93:/# su - ubiwan # login ubiwan user
and when logged in ubiwan
, password doesn't seem mosesdocker
specified useradd -m -p mosesdocker -s /bin/bash ubiwan
. i've typed correct password get:
to run command administrator (user "root"), use "sudo <command>". see "man sudo_root" details. ubiwan@6da1c5bc7f93:~$ sudo su [sudo] password ubiwan: sorry, try again. [sudo] password ubiwan: sorry, try again. [sudo] password ubiwan: sudo: 3 incorrect password attempts
why so?
is possible use sudo
in docker? "suggested" perform sudo
actions in docker?
how write docker script such sudo works in docker user?
you need set password user root using passwd.
first of type exit if logged in ubiwan. root type:
passwd ubiwan
give password user. can use sudo ubiwan user password
Comments
Post a Comment