Skip to content

Conversation

@tianon
Copy link
Member

@tianon tianon commented Oct 15, 2013

This is the result of a long and hairy discussion with @shykes on IRC regarding separate dockerinit.

The logic for docker to officially find dockerinit is as follows:

  • if _DOCKER_INIT_PATH is set and is the path to an executable, we use that (especially for "go test" via ./hake/make.sh dynbinary dyntest)
  • if the docker binary has a dockerinit executable in the same directory, we use that
  • if /usr/libexec/docker/dockerinit exists, we use that (esp. for packagers)
  • otherwise, we fall back to using docker itself as dockerinit, as we always have

I've also included a documentation update to hack/PACKAGERS.md regarding this last-resort method of compiling docker dynamically with a static dockerinit.

@alexlarsson
Copy link
Contributor

A lot of this already happens in the dm branc (same dir, _DOCKER_INIT_PATH) so this will conflict a bit.

@tianon
Copy link
Member Author

tianon commented Oct 15, 2013

The environment variable code got lost somewhere along the way to where we are now. The links branch is actually where the separate docker-init code is right now (hence why that's the merge target for this PR).

@alexlarsson
Copy link
Contributor

The env var code is here: https://github.com/dotcloud/docker/blob/dm/runtime.go#L51

@alexlarsson
Copy link
Contributor

Its non-ideal that the static docker-init is not on the same branch though :)

@tianon
Copy link
Member Author

tianon commented Oct 15, 2013

Oh, that's frustrating. I searched the links branch everywhere for that code.

@tianon
Copy link
Member Author

tianon commented Oct 17, 2013

Oh, this needs a rebase real bad. I'll rebase real fast.

@tianon
Copy link
Member Author

tianon commented Oct 17, 2013

rebased; ping @shykes

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FYI, this symlink is so that if we run ./bundles/VERSION/dynbinary/docker-VERSION, it works and picks up the proper dockerinit (because it won't look for a version-suffixed version; it could, if that's preferred to this tiny hack - as an alternative, we could just drop the VERSION suffix altogether here).

@alexlarsson
Copy link
Contributor

This kinda conflicts with the related work in the dm branch. For instance, that has a separate "docker-init" binary that avoids linking to all the extra stuff that docker uses (libdevmapper, sqlite etct) at: https://github.com/dotcloud/docker/blob/dm/docker-init/docker-init.go

Also, as i said above it has different code that does the picking of the docker-init file.

@tianon
Copy link
Member Author

tianon commented Oct 18, 2013

Well, as they stand now, it looks like "links" and "dm" are incompatible (I believe @vieux was working on this yesterday). I can adjust this PR to go against the "dm" branch instead without too much trouble. In my quick and rough attempt to do so now just to see what it would take, most of the big conflicts have actually been build script conflicts, but there are also the runtime*.go conflicts you mention (which were expected).

Originally, this was against the links branch and not the dm branch because at the time of its creation, the dm branch didn't have the separate docker-init folder. The links branch currently has the same "docker-init" folder, however and this PR renames it to "dockerinit" just so that we're consistent everywhere because it's historically mounted at /.dockerinit.

I can easily now recreate these changes against "dm" instead, if that'll make merging it all together simpler.

@tianon
Copy link
Member Author

tianon commented Oct 18, 2013

Ah, here's the commit the "dm" branch is missing that's the reason this is only possible on "links" right now: ab5d7ec

I'm almost done recreating this work completely on top of the "dm" branch, but that commit is the last piece I need. Should I cherry-pick it over as part of the new PR, or let that happen through some other means before I move forward?

@shykes
Copy link
Contributor

shykes commented Oct 18, 2013

How about cherry-picking it + pull request into master?

@solomonstre
@docker

On Fri, Oct 18, 2013 at 7:23 AM, Tianon Gravi notifications@github.com
wrote:

Ah, here's the commit the "dm" branch is missing that's the reason this is only possible on "links" right now: ab5d7ec

I'm almost done recreating this work completely on top of the "dm" branch, but that commit is the last piece I need. Should I cherry-pick it over as part of the new PR, or let that happen through some other means before I move forward?

Reply to this email directly or view it on GitHub:
#2217 (comment)

@tianon
Copy link
Member Author

tianon commented Oct 18, 2013

That'll work just fine; I'll do that a little later this morning.

@tianon tianon mentioned this pull request Oct 18, 2013
@tianon
Copy link
Member Author

tianon commented Oct 21, 2013

After discussing/testing this with @vieux and @shykes, this is now ready for merge against links.

…tic dockerinit binary

After a nice long brainstorming session with @shykes on IRC, we decided on using a SHA1 hash of dockerinit compiled into the dynamic docker binary to ensure that we always use the two in a perfect pair, and never mix and match.
vieux pushed a commit that referenced this pull request Oct 21, 2013
Added ability to create dynamic docker and static dockerinit through make scripts directly
@vieux vieux merged commit 7c30bd4 into moby:links Oct 21, 2013
@tianon tianon deleted the links-dynbinary branch October 21, 2013 23:00
cpuguy83 pushed a commit to cpuguy83/docker that referenced this pull request May 25, 2021
Check that generated protocol buffer code is up to date
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants