Code Block:
Running matrix
Environment
- Linux
- Mac/Windows
Command
- docker run
- docker compose
docker run
Mac/Windows -> no idea yet
docker run --add-host host.docker.internal:host-gateway ...
Linux -> use host
docker run -it --network host ...
docker compose
Mac/Windows use
host.docker.internal, cannot uselocalhost/127.0.0.1
docker-compose.yaml
# ... services: serviceName: build: context: . dockerfile: ./Dockerfile ## For macos/Windows extra_hosts: - "host.docker.internal:host-gateway" # ...
Linux use host or bridge, and then can use
localhost/127.0.0.1docker-compose.yaml
# ... services: serviceName: build: context: . dockerfile: ./Dockerfile ## For Linux network_mode: host # ...