简体   繁体   English

Docker:docker:来自守护进程的错误响应:linux 规范用户:无法找到用户 myuser:passwd 文件中没有匹配的条目

[英]Docker: docker: Error response from daemon: linux spec user: unable to find user myuser: no matching entries in passwd file

[root@mymachine redisc]# docker run -p 6379:6379 --user myuser redisc
docker: Error response from daemon: linux spec user: unable to find user myuser: no matching entries in passwd file.

but i can become myuser on the host但我可以成为主机上的 myuser

[root@mymachine redisc]# sudo su myuser
[myuser@mymachine redisc]#

How would i be able to run as myuser in the container?我如何才能在容器中以 myuser 身份运行?

The host and the container are completely separate.主机和容器是完全分开的。 You need to create myuser inside the redisc container before you try and run stuff as that user.在尝试以该用户身份运行内容之前,您需要在 redisc 容器创建myuser

According to the documentation you can use the ID of the user / group:根据文档,您可以使用用户/组的 ID:

When passing a numeric ID, the user does not have to exist in the container.传递数字 ID 时,用户不必存在于容器中。

Source: https://docs.docker.com/engine/reference/run/#user来源: https : //docs.docker.com/engine/reference/run/#user

The command could look like this:该命令可能如下所示:

docker run -p 6379:6379 --user 1001 redisc

You can mount read-only the host user info您可以以只读方式挂载主机用户信息

# user user and group IDs:
usr="--user $(id -u myuser):$(id -g myuser)"
mountdirs="-v /etc/passwd:/etc/passwd:ro -v /etc/shadow:/etc/shadow:ro -v /etc/group:/etc/group:ro"

options="-p 6379:6379"
# I use 
# options="-ti --rm --entrypoint=/bin/bash"

image=redisc

docker run ${options} ${usr} ${mountdirs} -w /home/myuser "${image}"

[root@host ~]# docker run --user=toto -ti fedora:26 uname [root@host ~]# docker run --user=toto -ti fedora:26 uname

/usr/bin/docker-current: Error response from daemon: linux spec user: unable to find user toto: no matching entries in passwd file. /usr/bin/docker-current:来自守护进程的错误响应:linux 规范用户:无法找到用户 toto:passwd 文件中没有匹配的条目。

[root@host ~]# docker run --user= id -u toto -ti fedora:26 uname [root@host ~]# docker run --user= id -u toto -ti fedora:26 uname

Linux Linux

I mistakenly thought a permission denied error was about access to my filesystem.我错误地认为权限被拒绝错误与访问我的文件系统有关。 I built a container that has a bash script as the entrypoint, but didn't give myself execution permission before building the image.我构建了一个以 bash 脚本作为入口点的容器,但在构建映像之前没有给自己执行权限。

chmod +x entrypoint.sh and rebuilding the image solved my issue. chmod +x entrypoint.sh并重建图像解决了我的问题。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 无法找到 root 用户:Docker 中的 passwd 文件中没有匹配的条目 - Unable to find user root: no matching entries in passwd file in Docker Docker 映像构建错误:无法找到用户管理员:passwd 文件中没有匹配的条目 - Docker image build Error : unable to find user admin: no matching entries in passwd file Docker 找不到用户:OpenJdk11 的 passwd 文件中没有匹配的条目 - Docker Unable to find user: no matching entries in passwd file for OpenJdk11 无法找到用户sail:passwd 文件中没有匹配的条目 - unable to find user sail: no matching entries in passwd file 无法找到 root 用户:passwd 文件中没有匹配的条目 - unable to find user root: no matching entries in passwd file Docker:来自守护程序的错误响应:用户拒绝目录共享 - Docker : Error response from daemon: user declined directory sharing daemon 的错误响应:open \\.\pipe\docker_engine_linux: The system cannot find the file specified - Error response from daemon: open \\.\pipe\docker_engine_linux: The system cannot find the file specified VS 代码远程容器:Shell 服务器终止(代码:126,信号:null)无法找到用户 xxx:passwd 文件中没有匹配的条目 - VS code Remote Container : Shell server terminated (code: 126, signal: null) unable to find user xxx: no matching entries in passwd file 来自守护进程的错误响应:无法识别的卷规范:无法映射文件 '\\\\.\\pipe\\docker_engine'。 此平台上只能映射目录 - Error response from daemon: Unrecognised volume spec: file '\\.\pipe\docker_engine' cannot be mapped. Only directories can be mapped on this platform 为什么我得到该错误“ docker:来自守护程序的错误响应:仅在用户定义的网络上支持用户指定的IP地址。”? - Why I'm obtaining that error “docker: Error response from daemon: user specified IP address is supported on user defined networks only.”?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM