本文介绍了如何以非root用户身份运行docker image?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我是码头工人的新人。当我使用命令运行docker图像ubuntu映像时,中有一个名为 foo 的用户,您可以执行以下操作:sudo docker run -i -t -u foo ubuntu:14.04 / bin / bash
注意: 参数相当于说明。
I'm new to docker. When I run a docker images like ubuntu image by using the command,
sudo docker run -i -t ubuntu:14.04By default, it is entering into the container as root like this.
I searched regarding this, but I couldn't get any of how to start a docker image as a non root user as I'm completely a starter for this topic.
It would be great if someone explains with an example of how to run a docker image as a non root user.
解决方案the docker run command has the -u parameter to allow you to specify a different user. In your case, and assuming you have a user named foo in your docker image, you could run:
sudo docker run -i -t -u foo ubuntu:14.04 /bin/bashNOTE: The -u parameter is the equivalent of the USER instruction for Dockerfile.
这篇关于如何以非root用户身份运行docker image?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!