whalebrew/whalebrew

Run package container with --init option

superbrothers opened this issue ยท 5 comments

whalebrew run command does not use --init option of docker run command for running packages. Due to this, some packages need tiny init such as dumb-init, for example https://github.com/whalebrew/whalebrew-packages/blob/master/wget/Dockerfile#L5.

dev@penguin:~/src/github.com/whalebrew/whalebrew$ git dc
diff --git a/cmd/run.go b/cmd/run.go
index 7ac79c7..d128496 100644
--- a/cmd/run.go
+++ b/cmd/run.go
@@ -44,6 +44,7 @@ var runCommand = &cobra.Command{
                        "run",
                        "--interactive",
                        "--rm",
+                       "--init",
                        "--workdir", os.ExpandEnv(pkg.WorkingDir),
                        "-v", fmt.Sprintf("%s:%s", cwd, os.ExpandEnv(pkg.WorkingDir)),
                }

TBW, what version of docker CLI is supported in whalebrew? --init option of docker run command was added in docker 1.13. If whalebrew has support for less than 1.13, whalebrew needs to detect the version of docker CLI used for resolving this issue.

// I'm happy that this project will be active again. ๐Ÿ˜Š

Thanks for the proposal, this sounds a pretty good idea!
Can we think of any corner case where the init option may cause some issue?

from GitHub, it seems that docker 1.13 did not have any fixes since April 2017. It sounds reasonable to say that docker versions are supported up to the last 2 years, older versions being best effort.
Although, we would need a plan to communicate so, and a rollout phase (like fist detecting the version and warning prior to dropping support)

Docker 1.13 has reached EOL a long time ago, and should definitely no longer be used (there's known vulnerabilities in those old versions)

Docker 1.13 has reached EOL a long time ago, and should definitely no longer be used (there's known vulnerabilities in those old versions)

@tjamet @thaJeztah Thanks! I understand that we can consider there are no docker 1.13 users at least. However whalebrew might need to decide the support version of docker as another issue.

Can we think of any corner case where the init option may cause some issue?

@tjamet I think no corner case, but I can not say that's absolutely true. So I propose another approch. We can also use whalebrew configuration as follows:

LABEL io.whalebrew.config.init true
diff --git a/cmd/run.go b/cmd/run.go
index 7ac79c7..57d4742 100644
--- a/cmd/run.go
+++ b/cmd/run.go
@@ -74,6 +74,9 @@ var runCommand = &cobra.Command{
                        dockerArgs = append(dockerArgs, "--net")
                        dockerArgs = append(dockerArgs, network)
                }
+               if pkg.Init {
+                       dockerArgs = append(dockerArgs, "--init")
+               }

                user, err := user.Current()
                if err != nil {

This approch has no impact for current packages.

Adding it for everything sounds fine to me - no option is better.

I think we should release a 1.0.0 soon so this is the opportunity to make breaking changes. :)