Is there a way to use dagger to effectively do a "docker run" command on a dagger.Container object? I've tried just using container.Stdout(ctx) but I can not find the mongo container with docker ps -a. I'm probably missing something obvious, or trying to mis-use CI/CD to run app code
In my use-case I do not need to push the images to a remote registry, I want to just build the mongo container and start running it
func BuildMongo(ctx context.Context, client *dagger.Client) *dagger.Container {
err := godotenv.Load()
if err != nil {
panic(err)
}
username := os.Getenv("MONGO_INITDB_ROOT_USERNAME")
password := os.Getenv("MONGO_INITDB_ROOT_PASSWORD")
mongoContainer := client.Container().From("docker.io/mongo:latest").WithEnvVariable("MONGO_INITDB_ROOT_USERNAME", username).WithEnvVariable("MONGO_INITDB_ROOT_PASSWORD", password)
mongoContainer.WithEntrypoint([]string{"-d", "hak247", "--port", "27017"})
return mongoContainer
}
func StartMongo(ctx context.Context, mongoContainer *dagger.Container) {
mongoContainer.Stdout(ctx)
}