aider/benchmark/docker.sh
Paul Gauthier 5e4ac44008 aider: Add port forwarding for the client inside the container to connect to the Ollama server on the host.
# Aider chat conversation:

USER: add a port fwd so a client inside the contain can connect to the ollama server running on the host

ASSISTANT: To forward a port so that a client inside the container can connect to the Ollama server running on the host, you need to add a `--publish` or `-p` option to the `docker run` command in the `benchmark/docker.sh` script. This option takes the format `host_port:container_port`.

Assuming the Ollama server is running on port 12345 on the host, and you want to use the same port inside the container, the diff would look like this:

```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 \
+       -p 12345:12345 \
        aider-benchmark \
        bash
```

This change will forward port 12345 from the host to port 12345 in the container, allowing a client inside the container to connect to the Ollama server running on the host machine.
2024-05-01 13:46:45 -07:00

13 lines
333 B
Bash
Executable file

#!/bin/bash
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 \
-p 12345:12345 \
aider-benchmark \
bash