Hey guys! So, I'm trying to run Postgres as a service, which is meant to be bind to a Rust container. I'm using the following code:
// test job
func Test(ctx context.Context, env map[string]string) error {
...
// setup postgres service
postgres := client.Container().From("postgres:16").
WithEnvVariable("POSTGRES_PASSWORD", "test").
WithExec([]string{"postgres"}).
WithExposedPort(5432).
AsService(dagger.ContainerAsServiceOpts{UseEntrypoint: true})
// setup test container
test := client.Container().From("rust:slim").
WithServiceBinding("postgres", postgres).
WithEnvVariable("CARGO_TERM_COLOR", env["CARGO_TERM_COLOR"]).
WithEnvVariable("SQLX_VERSION", env["SQLX_VERSION"]).
WithEnvVariable("SQLX_FEATURES", env["SQLX_FEATURES"]).
WithEnvVariable("DB_HOST", "postgres").
WithEnvVariable("POSTGRES_USER", "postgres").
WithEnvVariable("POSTGRES_PASSWORD", "test").
WithEnvVariable("POSTGRES_DB", "postgres").
WithDirectory("/hello-rust", client.Host().Directory("."))
...
}
When I run the pipeline, I get the following error:
Error logs:
✘ .withExec(args: ["postgres"]): Container! 0.8s
"root" execution of the PostgreSQL server is not permitted.
The server must be started under an unprivileged user ID to prevent
possible system security compromise.
I'm using Dagger 0.15.1. Do you know what is the issue here?