问题描述
我有多个 Atlassian 产品的容器;JIRA
、Bitbucket
和 Confluence
.当我尝试访问我通常使用的正在运行的容器时:
I have containers for multiple Atlassian products; JIRA
, Bitbucket
and 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.
这是第一个故障点,脚本每周运行一次(由Jenkins调度).
This is the first point of failure, and the script is running once each week (scheduled by 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
当脚本向 Bitbucket 容器执行这两行时,结果是:
When the script executes these two lines towards the Bitbucket container the result is:
unable to find user root: no matching entries in passwd file
它在docker cp"命令上失败,但仅针对 Bitbucket 容器.脚本运行后,bitbucket"(在 Dockerfile 中定义)和root"用户都无法访问容器.
It's failing on the 'docker cp'-command, but only towards the Bitbucket container. After the script has ran, the container is unaccessible with both the 'bitbucket' (defined in Dockerfile) and 'root' users.
我能够将 /etc/passwd
从容器中复制出来,并且它包含了预期的所有用户.尝试通过 uid 访问时,出现以下错误:
I was able to copy /etc/passwd
out of the container, and it contains all of the users as expected. When trying to access by uid, I get the following error:
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"
Bitbucket 镜像的 Dockerfile:
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"]
附加信息:
- Docker 版本 1.12.0,构建 8eab29e
- docker-compose 1.8.0 版,构建 f3628c7
- 所有容器都一直在运行,甚至 Bitbucket 在问题发生后也照常运行
- 重启容器后问题消失
推荐答案
这个问题是由 docker 引擎错误引起的,但是私下跟踪,Docker 正在询问用户重新启动引擎!
This issue is caused by a docker engine bug but which is tracked privately, Docker is asking users to restart the engine!
看来这个bug很可能已经超过两年了!
It seems that the bug is likely to be older than two years!
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.
这篇关于无法找到 root 用户:Docker 中的 passwd 文件中没有匹配的条目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!