Skip to content

Commit 362c5df

Browse files
committed
Update README to handle Docker host connection for different setups
- Added instructions for setting DOCKER_HOST variable to host.docker.internal when using Docker Desktop. - Removed unnecessary defining Signed-off-by: sinadarbouy <sinadarbouy@gmail.com>
1 parent 45958a6 commit 362c5df

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

getting-started/running-gatewayd.md

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,20 @@ Use the following command to start a PostgreSQL database server inside a contain
2929
docker run --rm --name postgres-test -p 5432:5432 -e POSTGRES_PASSWORD=postgres -d postgres
3030
```
3131

32-
Test your database by running the following command:
32+
**If `docker0` bridge exists**
3333

3434
```bash
3535
DOCKER_HOST=$(ip addr show docker0 | grep inet | grep -v inet6 | awk -F' ' '{ print $2 }' | sed 's/\/16//g')
36+
```
37+
38+
**if there is no `docker0` bridge (using Docker Desktop)**
39+
Use the DNS name `host.docker.internal`, which resolves to the internal IP address used by the host.
40+
```bash
41+
DOCKER_HOST="host.docker.internal"
42+
```
43+
44+
Run the following command to test your database:
45+
```bash
3646
docker exec -it postgres-test psql postgresql://postgres:postgres@${DOCKER_HOST}:5432/postgres -c "\d"
3747
```
3848

@@ -120,7 +130,6 @@ Running GatewayD will produce the following log output, which means that Gateway
120130
GatewayD is running on the host, while PostgreSQL is running inside a container. You can run the following command to test it. Notice that `${DOCKER_HOST}` holds the IP address of the host machine, that is accessible from inside the container.
121131

122132
```bash
123-
DOCKER_HOST=$(ip addr show docker0 | grep inet | grep -v inet6 | awk -F' ' '{ print $2 }' | sed 's/\/16//g')
124133
docker exec -it postgres-test psql postgresql://postgres:postgres@${DOCKER_HOST}:15432/postgres
125134
```
126135

0 commit comments

Comments
 (0)