在docker里面root的密码在变,通过其他用户无法直接切换到root,要实现以root身份登录,可以考虑一下方式:
tjadmin@TJ-Server:/var/lib/docker$ sudo docker ps
[sudo] password for tjadmin:
Sorry, try again.
[sudo] password for tjadmin:
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
9e847654f0b6 oracle_db "/bin/sh -c 'exec $O…" 17 hours ago Up About an hour 0.0.0.0:1521->1521/tcp vigilant_nash
a6d55be7ee4f tomcat6 "/opt/tomcat6/bin/ca…" 28 hours ago Up 16 hours 8000/tcp, 8020/tcp, 0.0.0.0:8010->8010/tcp tomcat_tj_1
tjadmin@TJ-Server:/var/lib/docker$
jadmin@TJ-Server:/var/lib/docker$ sudo docker exec -it -u root 9e847654f0b6 bash
bash-4.2#
之后,就可以以root 身份执行操作了。
|