【发布时间】:2021-09-19 02:41:36
【问题描述】:
Digital Ocean 告诉我,Redis 可能无意中暴露数据或配置错误以允许未经授权的访问。
一个 telnet 命令确认了这一点。
但是,我需要允许我在同一网络上的 docker 容器访问 Redis;启用外部访问似乎是唯一的方法!
如何配置我的 docker-compose 以允许两个容器之间的安全访问:
version: '2'
services:
redis:
networks:
- youtube
image: redis
ports:
- 6379:6379
expose:
- "6379"
container_name: youtube_cache
command: sh -c 'redis-server --bind 0.0.0.0'
restart: always
node:
tty: true # Enables debugging capabilities when attached to this container.
image: 'docker.io/bitnami/node:12-debian-10'
command: sh -c 'npm install && npm rebuild && node app'
volumes:
- .:/app
links:
- redis
environment:
- REDIS_URL=redis://youtube_cache
container_name: youtube_scraper
networks:
- youtube
restart: always
networks:
youtube:
external: true
【问题讨论】:
标签: docker security docker-compose redis