一般来说,这可能只是与WSL有关,但Redis是我的用例。
这很好,我可以连接如下:docker exec -it redis-1 redis-cli -c -p 7001 -a Password123
但是我不能从本地的windows pc连接到容器。我得到了
无法连接:连接到host.docker.internal:7001的错误10061。由于目标机器主动拒绝连接,因此无法建立连接。
当容器没有运行时,这也是相同的错误,所以不确定它是码头问题还是WSL?
version: '3.9'
services:
redis-cluster:
image: redis:latest
container_name: redis-cluster
command: redis-cli -a Password123 -p 7001 --cluster create 127.0.0.1:7001 127.0.0.1:7002 127.0.0.1:7003 127.0.0.1:7004 127.0.0.1:7005 127.0.0.1:7006 --cluster-replicas 1 --cluster-yes
depends_on:
- redis-1
- redis-2
- redis-3
- redis-4
- redis-5
- redis-6
network_mode: host
redis-1:
image: "redis:latest"
container_name: redis-1
network_mode: host
entrypoint: >
redis-server
--port 7001
--appendonly yes
--cluster-enabled yes
--cluster-config-file nodes.conf
--cluster-node-timeout 5000
--masterauth Password123
--requirepass Password123
--bind 0.0.0.0
--protected-mode no
# Five more the same as the abovehttps://stackoverflow.com/questions/68354678
复制相似问题