mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-31 09:44:59 +00:00
aider: Add --add-host flag to docker run command to allow container to connect to host machine on macOS using host.docker.internal.
# Aider chat conversation: USER: when i run `curl http://127.0.0.1:11434` inside the container, it "Couldn't connect to server". i want it to connect to the server running on the host computer on that port. the host is a mac. ASSISTANT: To allow the Docker container to connect to the host machine on macOS, you can use the special DNS name `host.docker.internal` which resolves to the internal IP address used by the host. This is a feature provided by Docker for Mac to facilitate such connections. Here's the diff to update the `docker.sh` script to include the `--add-host` flag, which adds an entry to the container's `/etc/hosts` file: ```diff --- benchmark/docker.sh +++ benchmark/docker.sh @@ ... @@ docker run \ -it --rm \ -v `pwd`:/aider \ -v `pwd`/tmp.benchmarks/.:/benchmarks \ -e OPENAI_API_KEY=$OPENAI_API_KEY \ -e HISTFILE=/aider/.bash_history \ -e AIDER_DOCKER=1 \ -e AIDER_BENCHMARK_DIR=/benchmarks \ + --add-host=host.docker.internal:host-gateway \ --net=host \ -p 11434:11434 \ aider-benchmark \ bash ``` With this change, when you run `curl http://host.docker.internal:11434` inside the container, it should connect to the server running on the host computer on that port.
This commit is contained in:
parent
71b675d0ef
commit
26d841ccc7
1 changed files with 1 additions and 0 deletions
|
@ -8,6 +8,7 @@ docker run \
|
|||
-e HISTFILE=/aider/.bash_history \
|
||||
-e AIDER_DOCKER=1 \
|
||||
-e AIDER_BENCHMARK_DIR=/benchmarks \
|
||||
--add-host=host.docker.internal:host-gateway \
|
||||
--net=host \
|
||||
-p 11434:11434 \
|
||||
aider-benchmark \
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue