Docker overlay2:错误遍历文件系统:OSError [Errno 40]太多级别的符号链接 [英] Docker overlay2: error walking file system: OSError [Errno 40] Too many levels of symbolic links

查看:54
本文介绍了Docker overlay2:错误遍历文件系统:OSError [Errno 40]太多级别的符号链接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

主应用程序:starlette(python)Webapp上的uvicorn服务器

Main app: uvicorn server on starlette (python) webapp

当我尝试调试标题(错误日志如下)的错误时,在主机的FS(/var/lib/docker/overlay2/[IMAGE_HASH_FOLDER]

While I was trying to debug the error in the title (troubleshoot log is following below) running the below command at the host's FS (/var/lib/docker/overlay2/[IMAGE_HASH_FOLDER]

find -L ./ -mindepth 15

我找到了循环中涉及的文件.在本地是/usr/bin/X11 ,在服务器上,我得到以下信息:

I find the files involved in the loop. Locally is the /usr/bin/X11 and at server I'm getting the following:

错误遍历文件系统:OSError [Errno 40]太多级别的符号链接:'/dev/fd/6/dev/fd/6/dev/fd/6/dev/fd/6/dev/fd/6/dev/fd/6/dev/fd/6/dev/fd/6/dev/fd/6/dev/fd/6/dev/fd/6/dev/fd/6/dev/fd/6/dev/stderr'

冲突文件的所有者(FS是主机之一),在修剪后等待挂起的docker服务重新启动:

The owner of the conflicting files (FS is the one of the host), pending docker service restart after the pruning:

➜  overlay2 find -L ./ -mindepth 15          

find: File system loop detected; ‘./d2dba43e7cdbdec81bac529bb85908a7f859f227cda0149389f164272cb372e8/diff/usr/bin/X11’ is part of the same file system loop as ‘./d2dba43e7cdbdec81bac529bb85908a7f859f227cda0149389f164272cb372e8/diff/usr/bin’.

   find: File system loop detected; ‘./6ec18b03535c1dac329e05b2abdc68fb0eea742a06878d90f84c4de73ea6a4a9/merged/usr/bin/X11’ is part of the same file system loop as ‘./6ec18b03535c1dac329e05b2abdc68fb0eea742a06878d90f84c4de73ea6a4a9/merged/usr/bin’.

     find: File system loop detected; ‘./l/GCDLBXTJXAL5PFTI4BE3MM3OE2/usr/bin/X11’ is part of the same file system loop as ‘./l/GCDLBXTJXAL5PFTI4BE3MM3OE2/usr/bin’.
    
    ➜  overlay2 ls -l ./d2dba43e7cdbdec81bac529bb85908a7f859f227cda0149389f164272cb372e8/diff/usr/bin/X11
    lrwxrwxrwx 1 root root 1 May  3  2017 ./d2dba43e7cdbdec81bac529bb85908a7f859f227cda0149389f164272cb372e8/diff/usr/bin/X11 -> .

dockerfile:

The dockerfile:

FROM python:3.8

COPY src/ ./

RUN /usr/local/bin/python -m pip install --upgrade pip || true
RUN pip install -r requirements.txt || true

ARG POSTGRES_USER
ENV POSTGRES_USER=$POSTGRES_USER
ARG POSTGRES_PASSWORD
ENV POSTGRES_PASSWORD=$POSTGRES_PASSWORD
ARG POSTGRES_SERVER
ENV POSTGRES_SERVER=$POSTGRES_SERVER
ARG POSTGRES_DB
ENV POSTGRES_DB=$POSTGRES_DB
ARG POSTGRES_PORT
ENV POSTGRES_PORT=$POSTGRES_PORT
ARG SESSION_SECRET
ENV SESSION_SECRET=$SESSION_SECRET
ARG DO_YOU_WANT_USERS
ENV DO_YOU_WANT_USERS=$DO_YOU_WANT_USERS
ARG WHERE_AM_I
ENV WHERE_AM_I=$WHERE_AM_I
# SSL
ARG FORWARDED_ALLOW_IPS
ENV FORWARDED_ALLOW_IPS=$FORWARDED_ALLOW_IPS
ARG SSL_CERTIFICATE
ENV SSL_CERTIFICATE=$SSL_CERTIFICATE
ARG SSL_KEYFILE
ENV SSL_KEYFILE=$SSL_KEYFILE
ARG UPLOADS_PATH
ENV UPLOADS_PATH=$UPLOADS_PATH

RUN echo "FINAL STAGE - RUN APP"

EXPOSE 7000
CMD ["python", "run.py"]

要么用我通常绑定的卷来运行容器,要么

Either I run the container with the volume I usually bind:

UPLOADS_PATH=/var/opt/tmp
LOCAL_UPLOADS_PATH=/var/containers/TEST_UPLOADS

docker build --build-arg POSTGRES_USER --build-arg POSTGRES_PASSWORD --build-arg POSTGRES_SERVER --build-arg POSTGRES_DB --build-arg POSTGRES_PORT --build-arg UPLOADS_PATH --build-arg WHERE_AM_I --build-arg SESSION_SECRET --build-arg DO_YOU_WANT_USERS -t test .

docker run -d --name test_container -v ${LOCAL_UPLOADS_PATH}:${UPLOADS_PATH} -p 7000:7000 test

或没有绑定,我仍然得到相同的错误日志&该应用程序在每次请求后都会不断重新启动.

or without the binding, I still get the same error logs & the app is constantly restarting after every request.

怎么可能在图像中出现这样的循环(链接的文件?)?

How is possible to have such a loop (linked files?) inside the image?

更新

容器运行平稳,直到我用cybonized版本的pybcrypt和uvicorn更改了bcrypt库为止.

The container was running smoothly until I've changed bcrypt library with pybcrypt and uvicorn with its cythonized version.

非常感谢任何有关进一步探索的建议.

Much appreciate any suggestions on what to further explore.

P.S.我还尝试了 docker system prune -a ,尽管有不推荐使用的东西,但没有任何改变.

P.S. I've also tried the docker system prune -a, and although there were deprecated stuff, nothing changed.

P.S. 2:@jordanvrtanoski我按照您的建议将问题分开了.

P. S. 2: @jordanvrtanoski I've separated the question as you've suggested.

更新#2

跟随@jordanvrtanoski检查命令:

Following @jordanvrtanoski inspect command:

➜ docker image inspect -f $'{{.RepoTags}}\t{{.GraphDriver.Data.LowerDir}}' $(docker images -q)

[test:latest]   /var/lib/docker/overlay2/99e3b5db623ae543d045cc86c2d7d36400c8d1780ec4b86c297f5055bbdfe81a/diff:/var/lib/docker/overlay2/4ed6de1627ba5957c8fa9834c797a60d277c76e61f138d1b6909c55ef5475523/diff:/var/lib/docker/overlay2/7f790257bc4e6ed9e6ea6ef5bed0eb0cf3af213ea913484a40946a45639d8188/diff:/var/lib/docker/overlay2/c8e04185bdc7714e116615a3599a9832ebe2080b43f09b68331cca5d7c109371/diff:/var/lib/docker/overlay2/9ef94affd46bbcc11d62999ab0c59d6bf28cc6d51f13a7513b93bb209738940a/diff:/var/lib/docker/overlay2/62438cdccba1f312f34e8458e4ec695019e6af65107b2e16c3d7eaa53ca03c06/diff:/var/lib/docker/overlay2/9ec57b8b2680944690cdceae73c1c49b31716bd5efbed78bd3d54810bffdc7b6/diff:/var/lib/docker/overlay2/b2c4ce8d2b6764476a452489f58e615fcce939eaecb3d65466f81f5f115a5b5d/diff:/var/lib/docker/overlay2/f8609908601489fb7e3e28a32c423ee556ec041c69ba274a02de316ccbef5c48/diff:/var/lib/docker/overlay2/dcd13187b642277de35f299c1abb1d7d9695972e8b8893267a62f65338679080/diff:/var/lib/docker/overlay2/e2ed1696e3a34e69ed493da3a2c10b942f09384b1cebac54afebea6fef9c4521/diff
[python:3.8]    /var/lib/docker/overlay2/c8e04185bdc7714e116615a3599a9832ebe2080b43f09b68331cca5d7c109371/diff:/var/lib/docker/overlay2/9ef94affd46bbcc11d62999ab0c59d6bf28cc6d51f13a7513b93bb209738940a/diff:/var/lib/docker/overlay2/62438cdccba1f312f34e8458e4ec695019e6af65107b2e16c3d7eaa53ca03c06/diff:/var/lib/docker/overlay2/9ec57b8b2680944690cdceae73c1c49b31716bd5efbed78bd3d54810bffdc7b6/diff:/var/lib/docker/overlay2/b2c4ce8d2b6764476a452489f58e615fcce939eaecb3d65466f81f5f115a5b5d/diff:/var/lib/docker/overlay2/f8609908601489fb7e3e28a32c423ee556ec041c69ba274a02de316ccbef5c48/diff:/var/lib/docker/overlay2/dcd13187b642277de35f299c1abb1d7d9695972e8b8893267a62f65338679080/diff:/var/lib/docker/overlay2/e2ed1696e3a34e69ed493da3a2c10b942f09384b1cebac54afebea6fef9c4521/diff

更新#3

因此,在遵循了@jordanvrtanoski的两个建议之后,这篇文章(@Janith Shanilka): Docker overlay2占用了磁盘空间

So after following both @jordanvrtanoski advices & this post (@Janith Shanilka): Docker overlay2 eating Disk Space

我缺少以下文件:

nano /etc/docker/daemon.json

并填充:

{
  "storage-driver": "aufs"
}

然后 sudo systemctl restart docker

现在应用程序不会崩溃,但是我仍然在日志中看到相同的循环消息:

Now the app doesn't crash, but I'm still getting at logs the same loop message:

error walking file system: OSError [Errno 40] Too many levels of symbolic links: '/usr/bin/X11/X11/X11/X11/X11/X11/X11/X11/X11/X11/X11/X11/X11/X11/X11/X11/X11/X11/X11/X11/X11/X11/X11/X11/X11/X11/X11/X11/X11/X11/X11/X11/X11/X11/X11/X11/X11/cc'

也@jordanvrtanoski

also @jordanvrtanoski

➜  docker image inspect -f $'{{.RepoTags}}\t{{.GraphDriver.Data.LowerDir}}' $(docker images -q)


[test:latest]   <no value>
[python:3.8]    <no value>

我还注意到df有点奇怪,看起来docker的卷就像是基本主机文件系统的克隆"?

I've also noticed that df is a little weird, it looks like the docker's volume is like a 'clone' of the basic host's filesystem?

➜  df
Filesystem     1K-blocks     Used Available Use% Mounted on
udev             4046520        0   4046520   0% /dev
tmpfs             815676     3276    812400   1% /run
/dev/sda3       49014600 20123088  26798560  43% /
tmpfs            4078368      304   4078064   1% /dev/shm
tmpfs               5120        0      5120   0% /run/lock
tmpfs            4078368        0   4078368   0% /sys/fs/cgroup
/dev/sda1         474730   148714    296986  34% /boot
tmpfs             815672        0    815672   0% /run/user/0
none            49014600 20123088  26798560  43% /var/lib/docker/aufs/mnt/0d98503bd3ea82e353f6776c2d813a642536ad6dd4300299a8fc22b5d6348bc8

更新#4

因此,在@jordanvrtanoski的建议之后,我从'aufs'返回了docker进行覆盖.以下结果来自主机:

So after @jordanvrtanoski 's suggestion I returned docker to overlay, from 'aufs'. The below results are from the host:

➜cd/var/lib/docker/overlay2➜查找-L ./-mindepth 15查找:检测到文件系统循环;‘./2ecf467259235c8c4605b058bff4f80100790ee7f5010d4954d6aab1a7f28686/merged/usr/bin/X11'与``./2ecf467259235c8c4605b058bff4f80100790ee7f5010d4954/bin查找:检测到文件系统循环;"./6f39e8e2089c99f636da9a534e2ccbe7e41202eeb2ce645efa9387dd0ef0b908/diff/usr/bin/X11"与"./6f39e8e2089c99f636da9a534e2ccbe7e41202eeb2ceefe/bin/0.bin查找:检测到文件系统循环;"./l/5AOADDMRCAKLG2FQDDJEYC6CY2/usr/bin/X11"与"./l/5AOADDMRCAKLG2FQDDJEYC6CY2/usr/bin"是同一文件系统循环的一部分.

➜ cd /var/lib/docker/overlay2 ➜ find -L ./ -mindepth 15 find: File system loop detected; ‘./2ecf467259235c8c4605b058bff4f80100790ee7f5010d4954d6aab1a7f28686/merged/usr/bin/X11’ is part of the same file system loop as ‘./2ecf467259235c8c4605b058bff4f80100790ee7f5010d4954d6aab1a7f28686/merged/usr/bin’. find: File system loop detected; ‘./6f39e8e2089c99f636da9a534e2ccbe7e41202eeb2ce645efa9387dd0ef0b908/diff/usr/bin/X11’ is part of the same file system loop as ‘./6f39e8e2089c99f636da9a534e2ccbe7e41202eeb2ce645efa9387dd0ef0b908/diff/usr/bin’. find: File system loop detected; ‘./l/5AOADDMRCAKLG2FQDDJEYC6CY2/usr/bin/X11’ is part of the same file system loop as ‘./l/5AOADDMRCAKLG2FQDDJEYC6CY2/usr/bin’.

推荐答案

更新#5

找到了原因:lib uvicorn [standard] 是其自身的Cythonized版本.一旦我删除了它,所有的错误都消失了.因此,我将其移至uvicorn的github.

Found the cause: lib uvicorn[standard] is the cythonized version of itself. Once I removed it all errors were gone. So I'll move this to uvicorn's github.

@jordanvrtanoski再次感谢您的帮助!

@jordanvrtanoski Thank you once again for your help!

这篇关于Docker overlay2:错误遍历文件系统:OSError [Errno 40]太多级别的符号链接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆