User Tools

Site Tools


docker:host_port

From inside of a Docker container, how do I connect to the localhost of the machine?

Источник

If you are using Docker-for-mac or Docker-for-Windows 18.03+, connect to your mysql service using the host host.docker.internal (instead of the 127.0.0.1 in your connection string).

If you are using Docker-for-Linux 20.10.0+, you can also use the host host.docker.internal if you started your Docker container with the --add-host host.docker.internal:host-gateway option, or added the following snippet in your docker-compose.yml file:

extra_hosts:
    - "host.docker.internal:host-gateway"
docker/host_port.txt · Last modified: 2024/05/11 10:14 by Denis Evsyukov