Docker: cannot find root user: no matching entries in passwd file

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
+7
source share
2 answers

You can use this command to access the container with the root user:

docker exec -u 0 -i -t {container_name_or_hash} / bin / bash

try debugging with this. I think the script can remove or disable the root user.

+15
source

This problem is caused by a docker engine error, but which is tracked privately , Docker asks users to restart the engine!

It seems that the error may be older than two years!

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

... what can I say, someone is doing everything possible to get more funding.

0
source

Source: https://habr.com/ru/post/1262877/


All Articles