#How to set parameters when creating containers

1 messages · Page 1 of 1 (latest)

kind frigate
#

I want to build a minio container in my dagger pipeline, I do client.Container().From("bitnami/minio") but then how to I specifiy the parameters such as the --network, --name and such ?

delicate solstice
kind frigate
# delicate solstice 👋 Dagger is closer to `docker build` than to `docker run` so parameters like `-...

My particular issue is that I want to create 2 container next to my kubernetes cluster, I have a minio instance inside it, a minio container outside and a minio client container to interact with them, I need to have all of them in the same network right ? I'm stuck when trying to set aliases for both of the minio instances and only getting timeouts even tho I use .WithServiceBinding() on all of them

kind frigate
#

Is it possible to expose multiple port of a container ? like chaining

#
container.WithExposedPort(6443).WithExposedPort(8200).WithExposedPort(9001)
delicate solstice
#

yes, you can do that

kind frigate
#

I have an issue where

#
    k8s.k3s = k8s.client.Pipeline("k3s init").Container().
        From("rancher/k3s").
        WithMountedCache("/etc/rancher/k3s", k8s.configCache).
        WithMountedTemp("/etc/lib/cni").
        WithMountedTemp("/var/lib/kubelet").
        WithMountedTemp("/var/lib/rancher/k3s").
        WithMountedTemp("/var/log").
        WithEntrypoint([]string{"sh", "-c"}).
        WithExec([]string{"k3s server --disable metrics-server --disable traefik"}, dagger.ContainerWithExecOpts{InsecureRootCapabilities: true}).
        // WithExposedPort(8200).
        // WithExposedPort(4222).
        WithExposedPort(6443)
#

This work fine

#

But if I uncomment the two "WithExposedPort" lines, it the code gets really slow and eventually gets stuck

kind frigate
#

(These are the ports of the nodePort to the pods I want to be able to curl to from other containers)

delicate solstice
#

you don't necessarily need all the WithExposedPorts. They're mostly used as a "checkpoint" which dagger waits for before executing the other parts of the pipeline that depends on the service as it validates that the port is actually reachable

#

it doesn't bring any form of network segmentation or blocking from the steps depending on that service