简体   繁体   English

docker 容器文件权限不起作用

[英]docker container file permission not working

I'm trying to deploy a docker container on a client system and I get a permission error that I do not get on other system.我正在尝试在客户端系统上部署一个 docker 容器,但我收到了在其他系统上没有的权限错误。

The docker file that build the image is a simple python slim image构建镜像的 docker 文件是一个简单的 python slim 镜像

FROM python:3.9.7

RUN pip install --upgrade pip
RUN pip install numpy

When I run the container docker run --rm -it gwsli:latest /bin/bash I get the following errors when I list files Note I can create files (touch file.test)当我运行容器 docker run --rm -it gwsli:latest /bin/bash 列出文件时出现以下错误注意我可以创建文件(touch file.test)

ls: cannot access 'testFile': Operation not permitted
total 0
-????????? ? ? ? ?            ? testFile
root@d6bb2cd88de2:/home#

root@3ca428f6e2d5:/# cd /
root@3ca428f6e2d5:/# ls -l
ls: cannot access 'root': Operation not permitted
ls: cannot access 'opt': Operation not permitted
ls: cannot access 'boot': Operation not permitted
...
total 0
d????????? ? ? ? ?            ? bin
d????????? ? ? ? ?            ? boot
d????????? ? ? ? ?            ? dev
d????????? ? ? ? ?            ? etc
...

The target system is: Linux d6bb2cd88de2 4.4.0-31-generic #50-Ubuntu SMP Wed Jul 13 00:07:12 UTC 2016 x86_64 GNU/Linux docker version 18.09.2目标系统是:Linux d6bb2cd88de2 4.4.0-31-generic #50-Ubuntu SMP Wed Jul 13 00:07:12 UTC 2016 x86_64 GNU/Linux docker version 18.09.2

The container was built on: Linux sl2000 4.8.0-41-generic #44~16.04.1-Ubuntu SMP Fri Mar 3 17:11:16 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux docker version 18.09.7容器构建于:Linux sl2000 4.8.0-41-generic #44~16.04.1-Ubuntu SMP Fri Mar 3 17:11:16 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux docker version 18.09.7

I load the container with: docker load -i gwsli.tar.gz我加载容器:docker load -i gwsli.tar.gz

I do not have a good inte.net connection on the client site so I can't rebuild the image from there.我在客户端站点上没有良好的 inte.net 连接,所以我无法从那里重建图像。 Is it possible to fix the permission issue only from the linux command line?是否可以仅从 linux 命令行修复权限问题?

Thanks谢谢

I found a post with the same error and the fix was to use the buster image.我发现了一个有同样错误的帖子,修复方法是使用 buster 图像。 So I still don't undestand the cause but using所以我仍然不明白原因,但使用

FROM python:3.9-buster来自 python:3.9-克星

Fixed the issue.解决了这个问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM