非root用戶啓動redis容器報錯mkdir: cannot create directory '/bitnami/redis': Permission denied

 問題:
使用docker啓動容器時,報錯以下git

zh@debian:~/testPath$ docker-compose up redis
Starting testpath_redis_1 ... done
Attaching to testpath_redis_1
redis_1 |
redis_1 | Welcome to the Bitnami redis container
redis_1 | Subscribe to project updates by watching https://github.com/bitnami/bitnami-docker-redis
redis_1 | Submit issues and feature requests at https://github.com/bitnami/bitnami-docker-redis/issues
redis_1 | Send us your feedback at containers@bitnami.com
redis_1 |
redis_1 | INFO ==> ** Starting Redis setup **
redis_1 | WARN ==> You set the environment variable ALLOW_EMPTY_PASSWORD=yes. For safety reasons, do not use this flag in a production environment.
redis_1 | INFO ==> Initializing Redis...
redis_1 | mkdir: cannot create directory '/bitnami/redis': Permission denied

  


 解決方法 github

redis:
image: "bitnami/redis"
user: root #注意看這裏,添加了這一行後就能夠解決
ports:
- '127.0.0.1:6379:6379'
volumes:
- "/etc/localtime:/etc/localtime:ro"
- './redis:/bitnami/redis'
environment:
- ALLOW_EMPTY_PASSWORD=yes
restart: always 
相關文章
相關標籤/搜索