我有多个Atlassian产品的容器; JIRA,Bitbucket和Confluence.当我试图访问我经常使用的运行容器时:
docker exec -it -u root ${DOCKER_CONTAINER} bash
使用此命令,我可以像往常一样访问,但在运行脚本来提取和压缩日志文件后,我再也无法访问该容器了.
摘自’清理脚本’
这是第一个失败点,脚本每周运行一次(由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容器执行这两行时,结果是:
unable to find user root: no matching entries in passwd file
它在’docker cp’命令上失败了,但只是在Bitbucket容器上.脚本运行后,容器无法访问“bitbucket”(在Dockerfile中定义)和“root”用户.
我能够将/ etc / passwd复制出容器,它按预期包含所有用户.当尝试通过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"
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,build f3628c7
>所有容器都在运行,甚至Bitbucket在问题发生后照常工作
>重新启动容器后问题消失
最佳答案
原文链接:https://www.f2er.com/docker/436749.html