Steps:
Start with Dagger engine installed by the SDK:
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
6673b26d7d87 registry.dagger.io/engine:v0.8.4 "dagger-entrypoint.s…" About a minute ago Up About a minute dagger-engine-5097823f019aa092
5dbc5b6e5af5 kindest/node:v1.27.3 "/usr/local/bin/entr…" 36 hours ago Up 19 minutes 127.0.0.1:40113->6443/tcp kind-control-plane
As expected, host.docker.internal is not available automatically on Linux:
docker exec -it 61a2c128d6cb /bin/sh
/ # ping host.docker.internal
ping: bad address 'host.docker.internal'
Stop/remove the container, re-run with --add-host=host.docker.internal:host-gateway, and verify that host.docker.internal resolves within the Dagger Engine container proper (but not necessarily in Dagger API 'Containers'):
docker stop 6673b26d7d87; docker rm 6673b26d7d87
docker run -d --add-host=host.docker.internal:host-gateway --name dagger-engine-5097823f019aa092 --privileged registry.dagger.io/engine:v0.8.4
Container list again:
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
08406023da01 registry.dagger.io/engine:v0.8.4 "dagger-entrypoint.s…" 32 seconds ago Up 31 seconds dagger-engine-5097823f019aa092
5dbc5b6e5af5 kindest/node:v1.27.3 "/usr/local/bin/entr…" 36 hours ago Up 19 minutes 127.0.0.1:40113->6443/tcp kind-control-plane
docker exec -it 08406023da01 /bin/sh
/ # ping host.docker.internal
PING host.docker.internal (172.17.0.1): 56 data bytes
64 bytes from 172.17.0.1: seq=0 ttl=64 time=0.125 ms