#How to set parameters when creating containers
1 messages · Page 1 of 1 (latest)
👋 Dagger is closer to docker build than to docker run so parameters like --name don't make a lot of sense in this context. What are you having issues with particularly to build your minio container? Maybe I can help by understanding what you're trying to accomplish and what's particularly missing
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
Is it possible to expose multiple port of a container ? like chaining
container.WithExposedPort(6443).WithExposedPort(8200).WithExposedPort(9001)
yes, you can do that
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
(These are the ports of the nodePort to the pods I want to be able to curl to from other containers)
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