Commit graph

11 commits

Author SHA1 Message Date
Paul Gauthier (aider)
0a23c4abd6 feat: Configure bash history to save commands immediately 2024-12-24 08:03:01 -05:00
Paul Gauthier (aider)
6a0a97cb41 feat: Add host.docker.internal gateway to enable Ollama server access from container 2024-11-22 10:07:47 -08:00
Paul Gauthier
f0b794ce9c revert docker.sh 2024-05-03 14:46:52 -07:00
Paul Gauthier
26d841ccc7 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.
2024-05-01 13:54:30 -07:00
Paul Gauthier
71b675d0ef Add network host mode and change port mapping in docker run script. 2024-05-01 13:54:28 -07:00
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
Paul Gauthier
417305a569 AIDER_BENCHMARK_DIR 2023-06-29 18:13:54 -07:00
Paul Gauthier
92c2d47e20 added docker warning 2023-06-29 14:59:38 -07:00
Paul Gauthier
5ee455a05b docker environment for the whole benchmark 2023-06-29 14:19:00 -07:00
Paul Gauthier
0ab19aa97c aider: Add script to run a Docker container with Python 3.8 and launch bash.
# Context:
USER: run a docker with python3.8
ASSISTANT: To run a Docker container with Python 3.8, you
^C KeyboardInterrupt
USER: run a docker with python3.8 and launch bash
ASSISTANT: To run a Docker container with Python 3.8 and launch bash, you need to modify the `docker.sh` script in the `benchmark` directory.

Here is the change you need to make:

```bash
benchmark/docker.sh
<<<<<<< ORIGINAL

=======
#!/bin/bash
docker run -it --rm python:3.8 bash
>>>>>>> UPDATED
```

This script will start a Docker container using the Python 3.8 image and launch bash. You can run this script from the terminal with the command `./benchmark/docker.sh`. Make sure the script has execute permissions. You can add them with the command `chmod +x benchmark/docker.sh` if needed.
2023-06-29 11:57:36 -07:00
Paul Gauthier
c0a625d934 Added new files to the git repo: benchmark/docker.sh 2023-06-29 11:57:02 -07:00