gpt4 book ai didi

django - Docker compose 无法为 postgresql 和 redis 创建容器

转载 作者:行者123 更新时间:2023-11-29 13:19:24 25 4
gpt4 key购买 nike

我在使用 docker-compose 时遇到问题,无法为服务 postgresqlredis 创建容器,在我运行 docker 之后-compose up -d 我遇到了这个错误:

ERROR: for dockerizingdjango_postgres_1  Cannot create container for service postgres: b'invalid port specification: "None"'
Creating dockerizingdjango_redis_1 ...
Creating dockerizingdjango_redis_1 ... error
ERROR: for dockerizingdjango_redis_1 Cannot create container for service redis: b'invalid port specification: "None"'
ERROR: for postgres Cannot create container for service postgres: b'invalid port specification: "None"'
ERROR: for redis Cannot create container for service redis: b'invalid port specification: "None"'
ERROR: Encountered errors while bringing up the project.

docker-compose.yml 文件如下所示:

web:
restart: always
build: ./web
expose:
- "8000"
links:
- postgres:postgres
- redis:redis
volumes:
- /usr/src/app
- /usr/src/app/static
env_file: .env
environment:
DEBUG: 'true'
command: /usr/local/bin/gunicorn docker_django.wsgi:application -w 2 -b :8000

apache:
restart: always
build: ./apache/
ports:
- "80:80"
volumes:
- /www/static
- /www/media
volumes_from:
- web
links:
- web:web

postgres:
restart: always
image: postgres:latest
ports:
- "5432:5432"
volumes:
- pgdata:/var/lib/postgresql/data/

redis:
restart: always
image: redis:latest
ports:
- "6379:6379"
volumes:
- redisdata:/data

我正在使用这个版本的docker-compose:

docker-compose version 1.13.0, build 1719ceb
docker-py version: 2.3.0
CPython version: 3.4.3
OpenSSL version: OpenSSL 1.0.1f 6 Jan 2014

我也在这个容器中使用 python3.5,因为我在这个容器中提供 django,所以有人可以帮助我解释这里发生了什么,以及如何解决这个问题,谢谢。

最佳答案

您似乎遇到了这个问题(https://github.com/docker/compose/issues/4729)。链接中提到的解决方法是降级 compose 或升级 python。

关于django - Docker compose 无法为 postgresql 和 redis 创建容器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44428159/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com