Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update to docker 1.13.x #20656

Merged
merged 1 commit into from Jan 21, 2017
Merged

Update to docker 1.13.x #20656

merged 1 commit into from Jan 21, 2017

Conversation

vdemeester
Copy link
Member

@vdemeester vdemeester commented Nov 23, 2016

Motivation for this change

docker 1.13.0 is going to be released next month (more or less). This shouldn't be merged before official release but gives time to review. This change the package quite a bit, so let me describe the changes :

  • There is more binaries now : docker, dockerd, docker-proxy, docker-runc, docker-containerd, docker-containerd-shim and docker-init — from 5 projects : docker/docker, docker/runc (to follow docker release), docker/containerd, docker-libnetwork and krallin/tini.
  • The package builds all the pieces itself instead of depending to other packages like runc and containerd. This makes sure we have the same binary (from the same git commit) than the official release and thus have no weird bugs because of version mismatch.
  • The man pages of docker are in the process of beeing automatically generate so there is some missing man page in the current package. This aims to fix that as well (still working on it).
  • This adds a experimental options to the docker service too – to start docker with experimental features (using --experimental).

There is still a few things to do :

  • [ ] Fix missing man pages Currently, part of the manpages are generated in a docker container. I have no clean way to build manpage otherwise for now.. 😓
  • Handle version and build time better (docker version and docker info)
     containerd version:  (expected: 03e5862ec0d8d3b3f750e19fca3ee367e13c090e)
     runc version: N/A (expected: 51371867a01c467f08af739783b8beafc154c4d7)
     init version: N/A (expected: 949e6facb77383876aeff8a6944dde66b3089574)
    
  • Update the package to 1.13.0 when released (and on each rc too)
Things done
  • Tested using sandboxing
    (nix.useSandbox on NixOS,
    or option build-use-sandbox in nix.conf
    on non-NixOS)
  • Built on platform(s)
    • NixOS
    • macOS
    • Linux
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nox --run "nox-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Fits CONTRIBUTING.md.

  • Update docker version to 1.13
  • Build containerd, runc, tini, docker-proxy from the right
    version (little duplicated from conf in docker scripts)

@mention-bot
Copy link

@vdemeester, thanks for your PR! By analyzing the history of the files in this pull request, we identified @offlinehacker, @NeQuissimus and @benley to be potential reviewers.

DOCKER_BUILDTAGS = []
++ optional (systemd != null) [ "journald" ]
++ optional (btrfs-progs == null) "exclude_graphdriver_btrfs"
++ optional (devicemapper == null) "exclude_graphdriver_devicemapper";

postUnpack = ''
cp -fR ${dockerSrc} docker
Copy link
Member Author

Choose a reason for hiding this comment

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

I did get errors with chmod… I'm not used to multiple sources build so I hacked around for that… There might be a better solution 👼

, go, containerd, runc
, sqlite, iproute, bridge-utils, devicemapper, systemd
{ stdenv, lib, fetchFromGitHub, makeWrapper, cmake, pkgconfig
, go-md2man, libapparmor, apparmor-parser, libseccomp, git
Copy link
Member Author

Choose a reason for hiding this comment

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

runc needs git (for the commit hash I guess). I really wish there was another way like what we do for docker/docker but it doesn't seem so…

@vdemeester vdemeester force-pushed the docker_1_13 branch 3 times, most recently from 1a84108 to 9e36c54 Compare November 23, 2016 16:58
@offlinehacker
Copy link
Contributor

offlinehacker commented Nov 24, 2016

But we have separated packages for runc and containerd, why did you put them all into docker nix expression? You can update runc and containerd, and use closest stable release, the same as docker team should do. Even if exact "versions" are needed, the runc and containerd packages can be overrided and overrides can be put in all-package.nix, or if that looks kinda ugly, they can be also put into docker expression, but i would really like to reuse packages as much as possible. Also spearate package should be made for libnetwork and for tiny

@vdemeester
Copy link
Member Author

But we have separated packages for runs and containers, why did you put them all into docker nix expression?

So about that, there is a few reasons why I made that change.

For each docker release, it depends on specific version of containerd, runc, etc.. If you're not running the right version of it, you might encounter weird bugs and it might be tricky to debug or get help/support because of that.

Although package containerd and runc on their own is a good idea — because they can be used without docker — I'm don't really like the way it's currently done :

  • containerd and runc are copied in docker-runc and docker-containerd/docker-containerd-shim and packaged in the final docker package — this feels weird to me. Going on that path, it would make more sence to not do that (and not including docker-runc and docker-containerd* in the package), and use daemon flags to tell docker where to find the runtime and the containerd socket).
  • (I might be wrong on that one) as far as I can tell, I cannot pin a certain version of runc and containerd for this specific package. Let say I update runc and containerd to the right version (and I think I will, probably in separate PRs) and I depend on it. As containerd and runc are separate project, they could be released differently (most often, …). They could (sholud?) be updated separately from docker in nixpkgs (especially runc which is an oci project). And thus, I have no guarantee that the docker-runc and docker-containerd for this specific version of docker will stay the same and the one that work and should be shipped with docker. And then again, you could run into really weird bugs.

You can update runc and containerd, and use latest stable release. If docker's release process is bad, it does not mean we have to do equal.

I don't think there is good or bad release process. See this (packaging) as an embedded use of runc, containerd, etc..

@offlinehacker
Copy link
Contributor

offlinehacker commented Nov 24, 2016 via email

@offlinehacker
Copy link
Contributor

offlinehacker commented Nov 24, 2016 via email

@vdemeester
Copy link
Member Author

@offlinehacker ah, I think I see what you mean. I'll try to update accordingly soon 😉

@vdemeester
Copy link
Member Author

Alright, RC3 is out, I'll update this 👼

@vdemeester
Copy link
Member Author

Updated with 1.13.0-rc3 and using overrideDerivation instead, introducing docker-proxy.
I also update tini and make sure we can build tini-static. I'm not sure it's the right way to do it though ?

@vdemeester vdemeester force-pushed the docker_1_13 branch 3 times, most recently from e1b49a1 to 9c73079 Compare December 6, 2016 14:12
'';

meta = {
description = "Docker garbage collection of containers and images";
Copy link
Contributor

Choose a reason for hiding this comment

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

Please fix meta data

Copy link
Member Author

Choose a reason for hiding this comment

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

Oh wow, I guess I was a little bit tired 😂

sha256 = "0zj4kdis1vvc6dwn4gplqna0bs7v6d1y2zc8v80s3zi018inhznw";
};

patchPhase = ''
Copy link
Contributor

Choose a reason for hiding this comment

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

Why is this needed?

Copy link
Member Author

Choose a reason for hiding this comment

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

In tini the cmake file is patch to remove static from it. But in the case of docker, tini (docker-init in the end) have to be static. This is to override the patchPhase — wasn't sure it was the right move to it though.


with lib;

stdenv.mkDerivation rec {
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you use buildGoPackage instead? I'm ok with merging as is, but can be change somewhere in the future.

Copy link
Member Author

Choose a reason for hiding this comment

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

Oh right, I'll do that 👼

@offlinehacker
Copy link
Contributor

Besides comnents above, looks good to me :)

@vdemeester
Copy link
Member Author

@offlinehacker thanks 👍 I still need to fix the manpages (as they are incompletely generate for now) and then we'll just have to wait for the release 👼

@offlinehacker
Copy link
Contributor

Nice :)

@vdemeester vdemeester force-pushed the docker_1_13 branch 3 times, most recently from d4c0bdf to 5f7082b Compare December 31, 2016 09:34
@vdemeester
Copy link
Member Author

Updated to 1.13.0-rc4… I'll update for 1.13.0-rc5 this week.
Man page is gonna be a little bit tricky 😅 Gonna need some go library in build input as part of the man are generated by a go program..

@aneeshusa
Copy link
Contributor

overrideAttrs is a new alternative to overrideDerivation which is now preferred to use.

@vdemeester vdemeester force-pushed the docker_1_13 branch 3 times, most recently from 46390dc to 8e3e656 Compare January 17, 2017 14:49
- Update docker version to 1.13.0.
- Introduce now docker-proxy package (from libnetmork).
- Use overrideDerivation to set the correct version for docker.
- Update tini to make sure we can build it static.

Signed-off-by: Vincent Demeester <vincent@sbr.pm>
@vdemeester vdemeester changed the title WIP: Update to docker 1.13.x Update to docker 1.13.x Jan 19, 2017
@phanimahesh
Copy link
Contributor

docker 1.13 has been released few days ago. I just started locally patching the derivation and found this when I was halfway.

@vdemeester Will you be updatingthis to use buildGoPackage instead of mkDerivation?
@offlinehacker Any further comments or is this LGTM?

@offlinehacker
Copy link
Contributor

LGTM

@offlinehacker offlinehacker merged commit 4884fa4 into NixOS:master Jan 21, 2017
@vdemeester vdemeester deleted the docker_1_13 branch January 21, 2017 12:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants