Skip to main content

Host Services Access

Dagger Functions do not have access to the network of the host you invoke the Dagger Function from (i.e. the host you execute a CLI command like dagger call from). Instead, host network services need to be explicitly passed when executing dagger call.

To pass host network services as arguments when invoking a Dagger Function, specify them in the form tcp://<host>:<port>.

Assume that you have a PostgresQL database running locally on port 5432, as with:

docker run -d -e POSTGRES_PASSWORD=postgres -p 5432:5432 postgres

Here is an example of passing this host service as argument to a PostgreSQL client Dagger Function, which drops you to a prompt from where you can execute SQL queries:

dagger -m github.com/kpenfound/dagger-modules/postgres@v0.1.0 call client --db=postgres --user=postgres --password=postgres --server=tcp://localhost:5432