Not given when entering the container root jurisdiction , function python No permission when reading the file ,
# With root User enters container ,
docker exec -u 0 -it Container name /bin/bash
# Then execute the file
[email protected]:/app# python xx.py
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
docker-compose.yaml Add... To the file
privileged: true Parameters
perhaps
sudo docker run --privileged [image_name]