I have containers for several Atlassian products; JIRA , Bitbucket and Confluence . When I try to access working containers, I usually use:
docker exec -it -u root ${DOCKER_CONTAINER} bash
With this command, I can access as usual, but after running the script to extract and compress the log files, I can no longer access this container.
Excerpt from 'clean up script'
This is the first point of failure, and the script runs once a 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
When the script executes these two lines in the Bitbucket container, the result:
unable to find user root: no matching entries in passwd file
It does not work on the docker cp 'command, but only in the Bitbucket container. After running the script, the container is inaccessible with both a "bitpack" (defined in the Dockerfile) and with "root" users.
I managed to copy /etc/passwd from the container and it contains all the users as expected. When trying to access via 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"
Docker File for Bitbucket Image:
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"]
Additional Information:
- Docker version 1.12.0, build 8eab29e
- docker-compose version 1.8.0, build f3628c7
- All containers work always, even Bitbucket works as usual after a problem.
- The problem disappears after the container is reloaded