I am connecting to Redis from the spring boot app on the outside machine where the Redis server docker container is not running. When the app tries to connect to Redis, the app can't connect properly until the sent request is timed out. Meanwhile, if I try to connect from:
application.properties:
spring.redis.host=pc-1
spring.redis.port=6379
pc-1
is alias from some numerical ip. I'am using hosts feature from windows to aliasing/redirecting it.
.env:
REDIS_PORT=6379
docker-compose.yml:
redis:
image: redis:latest
ports:
- "${REDIS_PORT}:6379"
command:
# - redis-server
# - --requirepass "${REDIS_PASSWORD}"
networks:
- redis
healthcheck:
test: ["CMD-SHELL", "redis-cli ping"]
interval: 10s
timeout: 10s
retries: 3
I need help on this issue.
Update: I'm ignoring this question because it is currently not relevant to my work now. I suspect this is because of bugs or limited features in Docker Windows or WSL. Specifically, the numerical IP and alphabetical address I have used perhaps using the connection route to the router I have been using. Additionally, my machines are connected not only by just one adapter. So, the success of the connection might be random. When this question was asked initially, the WSL did not support a connection to the router. To support it, we need to enable the recent experimental mirrored networking feature.
I suspect this is because of bugs or limited features in Docker Windows or WSL. Specifically, the numerical IP and alphabetical address I have used perhaps using the connection route to the router I have been using. Additionally, my machines are connected not only by just one adapter. So, the success of the connection might be random. When this question was asked initially, the WSL did not support a connection to the router. To support it, we need to enable the recent experimental mirrored networking feature.
Links: