Equivalent of "docker run --init" using the Go SDK? #46883
-
I'm creating some containers in Go using the SDK (https://pkg.go.dev/github.com/docker/docker/client). I'd like to start a containers with an init process (https://docs.docker.com/engine/reference/run/#specify-an-init-process). On the CLI, I'd do this with |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
The And moby/api/types/container/hostconfig.go Lines 472 to 473 in df59a35 And the API docs; https://docs.docker.com/engine/api/v1.43/#tag/Container/operation/ContainerCreate |
Beta Was this translation helpful? Give feedback.
The
init
option is set in theHostConfig
struct; see https://github.com/docker/cli/blob/v24.0.7/cli/command/container/opts.go#L673-L676And
moby/api/types/container/hostconfig.go
Lines 472 to 473 in df59a35
And the API docs; https://docs.docker.com/engine/api/v1.43/#tag/Container/operation/ContainerCreate