- suppose I use a web service (in any language) and a Redis service, and when I run the redis service in docker, map out port 6379 so that the local web service can also use Redis.
- but on the other hand, if you run the Redis service locally, and the port is also 6379 running the web service in the docker, is it impossible to access the external Redis service in the container?
because the container is independent from the host, you need to establish communication through the port and map port 6379 of the Redis container. The system will say that this port is occupied, the Redis service of the host is stopped, and the container can be started. However, when you start the Redis of the host, it will also indicate that the port is occupied.
so I would like to ask whether it is not possible to access the host service within the container. Because the container itself needs to occupy the port to communicate with the host, and the host of this port wants to start Redis, it falls into a dead knot in which the ports occupy each other.