程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
您现在的位置: 程式師世界 >> 編程語言 >  >> 更多編程語言 >> Python

When running Python file in docker, the error permissionerror: [errno 13] permission denied: . / data / xx.pkl‘

編輯:Python

Error reason :

Not given when entering the container root jurisdiction , function python No permission when reading the file ,

terms of settlement :

1、 Use in container -u 0 Parameters

# With root User enters container ,
docker exec -u 0 -it Container name /bin/bash
# Then execute the file 
[email protected]:/app# python xx.py

2、 confirm Privileged state

docker inspect Confirm the status

docker inspect --format='{
{.HostConfig.Privileged}}' [container_id]

Example :

[email protected]10_1_160_73:~# docker inspect --format='{
{.HostConfig.Privileged}}' 99fc4cce3246
false
# If 'false' It indicates that... Was not added when creating the container --privileged Parameters 

Amendments :

docker-compose.yaml Add... To the file
privileged: true Parameters
perhaps
sudo docker run --privileged [image_name]

  1. 上一篇文章:
  2. 下一篇文章:
Copyright © 程式師世界 All Rights Reserved