Root password inside a Docker container

前端 未结 16 708
没有蜡笔的小新
没有蜡笔的小新 2020-12-02 03:24

I\'m using a Docker image which was built using the USER command to use a non-root user called dev. Inside a container, I\'m \"dev\", but I want to edit the

16条回答
  •  温柔的废话
    2020-12-02 04:00

    By default docker containers run as the root user.

    If you are still using the container you can use exit command to get back to root (default user) user instead of running the container again.

    Example -

    [dev@6c4c86bccf93 ~]$ ls
    [dev@6c4c86bccf93 ~]$ other-commands..
    [dev@6c4c86bccf93 ~]$ exit
    [root@6c4c86bccf93 /]# ls
    

提交回复
热议问题