Closed AgonyDebugger closed 1 year ago
redis 连接没问题,程序也正常运行,但是 Response code 是 502,是因为我没启动 webApi 服务吗,应该怎么启动,这是我的 docker-compose.yml
version: '3.9' services: proxy_pool: image: jhao104/proxy_pool ports: - "5010:5010" environment: - HOST=127.0.0.1 - DB_CONN=redis://:123456@host.docker.internal:6380/0 - POOL_SIZE_MIN=10 depends_on: - redis # redis 配置 redis: image: redis:6.2-alpine command: redis-server --requirepass 123456 ports: - "6380:6379" volumes: - /d/develop_tools/produce/redis:/data
日志打印: docker_tools-redis-1 | 1:M 01 Jul 2023 16:11:56.052 100 changes in 300 seconds. Saving... docker_tools-redis-1 | 1:M 01 Jul 2023 16:11:56.053 Background saving started by pid 18 docker_tools-redis-1 | 18:C 01 Jul 2023 16:11:56.232 DB saved on disk docker_tools-redis-1 | 18:C 01 Jul 2023 16:11:56.234 RDB: 0 MB of memory used by copy-on-write docker_tools-redis-1 | 1:M 01 Jul 2023 16:11:56.255 * Background saving terminated with success
解决了,HOST 变量的问题,127.0.0.1 只监听容器内部的回环地址,而不是宿主机的地址。
HOST
127.0.0.1
redis 连接没问题,程序也正常运行,但是 Response code 是 502,是因为我没启动 webApi 服务吗,应该怎么启动,这是我的 docker-compose.yml
日志打印: docker_tools-redis-1 | 1:M 01 Jul 2023 16:11:56.052 100 changes in 300 seconds. Saving... docker_tools-redis-1 | 1:M 01 Jul 2023 16:11:56.053 Background saving started by pid 18 docker_tools-redis-1 | 18:C 01 Jul 2023 16:11:56.232 DB saved on disk docker_tools-redis-1 | 18:C 01 Jul 2023 16:11:56.234 RDB: 0 MB of memory used by copy-on-write docker_tools-redis-1 | 1:M 01 Jul 2023 16:11:56.255 * Background saving terminated with success