diff --git a/README.md b/README.md index 670b945..ad1bf07 100644 --- a/README.md +++ b/README.md @@ -95,7 +95,7 @@ More detailed instructions are in the [`example README.md`](https://github.com/R | **image** | string | yes | OCI image (docker is also OCI compatible) for your container. | | **command** | string | no | Command to override command defined in the image. | | **args** | []string | no | Arguments to the command. | -| **entrypoint** | string | no | Overwrite the default ENTRYPOINT of the image. | +| **entrypoint** | []string | no | A string list overriding the image's entrypoint. | | **cwd** | string | no | Specify the current working directory for your container process. If the directory does not exist, one will be created for you. | | **privileged** | bool | no | Run container in privileged mode. Your container will have all linux capabilities when running in privileged mode. | | **host_dns** | bool | no | Default (`true`). By default, a container launched using `containerd-driver` will use host `/etc/resolv.conf`. This is similar to [`docker behavior`](https://docs.docker.com/config/containers/container-networking/#dns-services). However, if you don't want to use host DNS, you can turn off this flag by setting `host_dns=false`. | diff --git a/containerd/containerd.go b/containerd/containerd.go index 15985b6..df2b604 100644 --- a/containerd/containerd.go +++ b/containerd/containerd.go @@ -76,7 +76,7 @@ func (d *Driver) pullImage(imageName string) (containerd.Image, error) { } func (d *Driver) createContainer(containerConfig *ContainerConfig, config *TaskConfig) (containerd.Container, error) { - if config.Command != "" && config.Entrypoint != "" { + if config.Command != "" && config.Entrypoint != nil { return nil, fmt.Errorf("Both command and entrypoint are set. Only one of them needs to be set.") } @@ -84,8 +84,8 @@ func (d *Driver) createContainer(containerConfig *ContainerConfig, config *TaskC var args []string if config.Command != "" { args = append(args, config.Command) - } else if config.Entrypoint != "" { - args = append(args, config.Entrypoint) + } else if config.Entrypoint != nil && config.Entrypoint[0] != "" { + args = append(args, config.Entrypoint...) } // Arguments to the command set by the user. @@ -95,7 +95,7 @@ func (d *Driver) createContainer(containerConfig *ContainerConfig, config *TaskC var opts []oci.SpecOpts - if config.Entrypoint != "" { + if config.Entrypoint != nil { opts = append(opts, oci.WithProcessArgs(args...)) } else { opts = append(opts, oci.WithImageConfigArgs(containerConfig.Image, args)) diff --git a/containerd/driver.go b/containerd/driver.go index 7e91d32..eafabc3 100644 --- a/containerd/driver.go +++ b/containerd/driver.go @@ -103,7 +103,7 @@ var ( hclspec.NewLiteral("true"), ), "extra_hosts": hclspec.NewAttr("extra_hosts", "list(string)", false), - "entrypoint": hclspec.NewAttr("entrypoint", "string", false), + "entrypoint": hclspec.NewAttr("entrypoint", "list(string)", false), "seccomp": hclspec.NewAttr("seccomp", "bool", false), "seccomp_profile": hclspec.NewAttr("seccomp_profile", "string", false), "readonly_rootfs": hclspec.NewAttr("readonly_rootfs", "bool", false), @@ -162,7 +162,7 @@ type TaskConfig struct { Privileged bool `codec:"privileged"` HostDNS bool `codec:"host_dns"` ExtraHosts []string `codec:"extra_hosts"` - Entrypoint string `codec:"entrypoint"` + Entrypoint []string `codec:"entrypoint"` ReadOnlyRootfs bool `codec:"readonly_rootfs"` HostNetwork bool `codec:"host_network"` Mounts []Mount `codec:"mounts"`