su terminal get around---docker root

su : must be run from a terminal

After some googling, I found the solution from Tero's glob. If you have python installed, just run the following from your shell:

echo "import pty; pty.spawn('/bin/bash')" > /tmp/asdf.py
python /tmp/asdf.py

30 down vote
 

You can log into the Docker Image using the root user (ID = 0) instead of the provided default user when you use the -u option. E.g.

docker exec -u 0 -it mycontainer bash

root (id = 0) is the default user within a container. The image developer can create additional users. Those users are accessible by name. When passing a numeric ID, the user does not have to exist in the container.

posted on 2016-06-24 15:32  szllq2000  阅读(846)  评论(0)    收藏  举报