[英]Unable to find user root: no matching entries in passwd file in Docker
I have containers for multiple Atlassian products;我有多个 Atlassian 产品的容器;
JIRA
, Bitbucket
and Confluence
. JIRA
、 Bitbucket
和Confluence
。 When I'm trying to access the running containers I'm usually using:当我尝试访问正在运行的容器时,我通常使用:
docker exec -it -u root ${DOCKER_CONTAINER} bash
With this command I'm able to access as usual, but after running a script to extract and compress log files, I can't access that one container anymore.使用此命令,我可以像往常一样访问,但是在运行脚本以提取和压缩日志文件后,我无法再访问该容器。
This is the first point of failure, and the script is running once each week (scheduled by Jenkins).这是第一个故障点,脚本每周运行一次(由 Jenkins 调度)。
docker cp ${CLEAN_UP_SCRIPT} ${DOCKER_CONTAINER}:/tmp/${CLEAN_UP_SCRIPT}
if [ $? -eq 0 ]; then
docker exec -it -u root ${DOCKER_CONTAINER} bash -c "cd ${LOG_DIR} && /tmp/compressOldLogs.sh ${ARCHIVE_FILE}"
fi
When the script executes these two lines towards the Bitbucket container the result is:当脚本对 Bitbucket 容器执行这两行时,结果是:
unable to find user root: no matching entries in passwd file
It's failing on the 'docker cp'-command, but only towards the Bitbucket container.它在“docker cp”命令上失败,但仅针对 Bitbucket 容器。 After the script has ran, the container is unaccessible with both the 'bitbucket' (defined in Dockerfile) and 'root' users.
脚本运行后,“bitbucket”(在 Dockerfile 中定义)和“root”用户都无法访问容器。
I was able to copy /etc/passwd
out of the container, and it contains all of the users as expected.我能够将
/etc/passwd
从容器中复制出来,并且它包含了所有预期的用户。 When trying to access by uid, I get the following error:尝试通过 uid 访问时,出现以下错误:
rpc error: code = 2 desc = oci runtime error: exec failed: process_linux.go:75: starting setns process caused "fork/exec /proc/self/exe: no such file or directory"
FROM java:openjdk-8-jre
ENV BITBUCKET_HOME /var/atlassian/application-data/bitbucket
ENV BITBUCKET_INSTALL_DIR /opt/atlassian/bitbucket
ENV BITBUCKET_VERSION 4.12.0
ENV DOWNLOAD_URL https://downloads.atlassian.com/software/stash/downloads/atlassian-bitbucket-${BITBUCKET_VERSION}.tar.gz
ARG user=bitbucket
ARG group=bitbucket
ARG uid=1000
ARG gid=1000
RUN mkdir -p $(dirname $BITBUCKET_HOME) \
&& groupadd -g ${gid} ${group} \
&& useradd -d "$BITBUCKET_HOME" -u ${uid} -g ${gid} -m -s /bin/bash ${user}
RUN mkdir -p ${BITBUCKET_HOME} \
&& mkdir -p ${BITBUCKET_HOME}/shared \
&& chmod -R 700 ${BITBUCKET_HOME} \
&& chown -R ${user}:${group} ${BITBUCKET_HOME} \
&& mkdir -p ${BITBUCKET_INSTALL_DIR}/conf/Catalina \
&& curl -L --silent ${DOWNLOAD_URL} | tar -xz --strip=1 -C "$BITBUCKET_INSTALL_DIR" \
&& chmod -R 700 ${BITBUCKET_INSTALL_DIR}/ \
&& chown -R ${user}:${group} ${BITBUCKET_INSTALL_DIR}/
${BITBUCKET_INSTALL_DIR}/bin/setenv.sh
USER ${user}:${group}
EXPOSE 7990
EXPOSE 7999
WORKDIR $BITBUCKET_INSTALL_DIR
CMD ["bin/start-bitbucket.sh", "-fg"]
You can use this command to access to the container with root user:您可以使用此命令以 root 用户访问容器:
docker exec -u 0 -i -t {container_name_or_hash} /bin/bash
docker exec -u 0 -i -t {container_name_or_hash} /bin/bash
try debug with that.尝试调试。 i think the script maybe remove or disable root user.
我认为该脚本可能会删除或禁用 root 用户。
This issue is caused by a docker engine bug but which is tracked privately , Docker is asking users to restart the engine!此问题是由docker 引擎 bug引起的,但已私下跟踪,Docker 要求用户重新启动引擎!
It seems that the bug is likely to be older than two years!看来这个bug很可能已经超过两年了!
https://success.docker.com/article/ucp-health-checks-fail-unable-to-find-user-nobody-no-matching-entries-in-passwd-file-observed https://success.docker.com/article/ucp-health-checks-fail-unable-to-find-user-nobody-no-matching-entries-in-passwd-file-observed
https://forums.docker.com/t/unable-to-find-user-root-no-matching-entries-in-passwd-file/26545/7 https://forums.docker.com/t/unable-to-find-user-root-no-matching-entries-in-passwd-file/26545/7
... what can I say, someone is doing his best to get more funding. ...我能说什么,有人正在尽最大努力获得更多资金。
Its a Long standing issue, replicated on my old version 1.10.3 to at least 1.17这是一个长期存在的问题,在我的旧版本 1.10.3 上复制到至少 1.17
As mentioned by @sorin the the docker forum says Running docker stop and then docker start fixes the problem but is hardly a long-term solution
...正如@sorin 所提到的,docker 论坛说
Running docker stop and then docker start fixes the problem but is hardly a long-term solution
docker Running docker stop and then docker start fixes the problem but is hardly a long-term solution
......
The docker exec -u 0 -i -t {container_name_or_hash} /bin/bash
solution also in the same forum post mentioned here by @ObranZoltan might work for you, but does not work for many. docker exec -u 0 -i -t {container_name_or_hash} /bin/bash
解决方案也在@ObranZoltan 在这里提到的同一论坛帖子中可能对您有用,但对许多人不起作用。 See my output below请参阅下面的输出
$ sudo docker exec -u 0 -it berserk_nobel /bin/bash
exec: "/bin/bash": stat /bin/bash: input/output error
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.