Running docker on linux from hab packages

I’m doing work on the docker exporter and that requires running the docker dæmon:

[5][default:/src:1]# hab pkg export docker results/jbauman-sample-node-app-1.0.1-20180402210339-x86_64-linux.hart 
…
    Ω Creating Docker image
Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?
ERRO[0000] failed to dial gRPC: cannot connect to the Docker daemon. Is 'docker daemon' running on this host?: dial unix /var/run/docker.sock: connect: no such file or directory 
✗✗✗
✗✗✗ Docker build failed with exit code: exit code: 1
✗✗✗

I installed the core/docker habitat package and tried running dockerd from there, but there are quite a few issues:

➤ sudo hab pkg exec core/docker dockerd
WARN[2018-04-02T14:13:48.212344987-07:00] could not change group /var/run/docker.sock to docker: group docker not found 
INFO[2018-04-02T14:13:48.216335363-07:00] libcontainerd: started new docker-containerd process  pid=27069
INFO[0000] starting containerd                           module=containerd revision=89623f28b87a6004d4b785663257362d1658a729 version=v1.0.0
INFO[0000] setting subreaper...                          module=containerd
INFO[0000] changing OOM score to -500                    module=containerd
INFO[0000] loading plugin "io.containerd.content.v1.content"...  module=containerd type=io.containerd.content.v1
INFO[0000] loading plugin "io.containerd.snapshotter.v1.btrfs"...  module=containerd type=io.containerd.snapshotter.v1
WARN[0000] failed to load plugin io.containerd.snapshotter.v1.btrfs  error="path /var/lib/docker/containerd/daemon/io.containerd.snapshotter.v1.btrfs must be a btrfs filesystem to be used with the btrfs snapshotter" module=containerd
INFO[0000] loading plugin "io.containerd.snapshotter.v1.overlayfs"...  module=containerd type=io.containerd.snapshotter.v1
INFO[0000] loading plugin "io.containerd.metadata.v1.bolt"...  module=containerd type=io.containerd.metadata.v1
WARN[0000] could not use snapshotter btrfs in metadata plugin  error="path /var/lib/docker/containerd/daemon/io.containerd.snapshotter.v1.btrfs must be a btrfs filesystem to be used with the btrfs snapshotter" module="containerd/io.containerd.metadata.v1.bolt"
INFO[0000] loading plugin "io.containerd.differ.v1.walking"...  module=containerd type=io.containerd.differ.v1
INFO[0000] loading plugin "io.containerd.gc.v1.scheduler"...  module=containerd type=io.containerd.gc.v1
INFO[0000] loading plugin "io.containerd.grpc.v1.containers"...  module=containerd type=io.containerd.grpc.v1
INFO[0000] loading plugin "io.containerd.grpc.v1.content"...  module=containerd type=io.containerd.grpc.v1
INFO[0000] loading plugin "io.containerd.grpc.v1.diff"...  module=containerd type=io.containerd.grpc.v1
INFO[0000] loading plugin "io.containerd.grpc.v1.events"...  module=containerd type=io.containerd.grpc.v1
INFO[0000] loading plugin "io.containerd.grpc.v1.healthcheck"...  module=containerd type=io.containerd.grpc.v1
INFO[0000] loading plugin "io.containerd.grpc.v1.images"...  module=containerd type=io.containerd.grpc.v1
INFO[0000] loading plugin "io.containerd.grpc.v1.leases"...  module=containerd type=io.containerd.grpc.v1
INFO[0000] loading plugin "io.containerd.grpc.v1.namespaces"...  module=containerd type=io.containerd.grpc.v1
INFO[0000] loading plugin "io.containerd.grpc.v1.snapshots"...  module=containerd type=io.containerd.grpc.v1
INFO[0000] loading plugin "io.containerd.monitor.v1.cgroups"...  module=containerd type=io.containerd.monitor.v1
INFO[0000] loading plugin "io.containerd.runtime.v1.linux"...  module=containerd type=io.containerd.runtime.v1
INFO[0000] loading plugin "io.containerd.grpc.v1.tasks"...  module=containerd type=io.containerd.grpc.v1
INFO[0000] loading plugin "io.containerd.grpc.v1.version"...  module=containerd type=io.containerd.grpc.v1
INFO[0000] loading plugin "io.containerd.grpc.v1.introspection"...  module=containerd type=io.containerd.grpc.v1
INFO[0000] serving...                                    address="/var/run/docker/containerd/docker-containerd-debug.sock" module="containerd/debug"
INFO[0000] serving...                                    address="/var/run/docker/containerd/docker-containerd.sock" module="containerd/grpc"
INFO[0000] containerd successfully booted in 0.061427s   module=containerd
ERRO[2018-04-02T14:13:48.378933252-07:00] AppArmor enabled on system but the docker-default profile could not be loaded: running `apparmor_parser apparmor_parser --version` failed with output: 
error: exec: "apparmor_parser": executable file not found in $PATH 
ERRO[2018-04-02T14:13:48.382729209-07:00] 'overlay' not found as a supported filesystem on this host. Please ensure kernel is new enough and has overlay support loaded. 
ERRO[2018-04-02T14:13:48.382918389-07:00] 'overlay' not found as a supported filesystem on this host. Please ensure kernel is new enough and has overlay support loaded. 
ERRO[2018-04-02T14:13:48.382961469-07:00] Failed to built-in GetDriver graph devicemapper /var/lib/docker 
INFO[2018-04-02T14:13:48.426077399-07:00] Graph migration to content-addressability took 0.00 seconds 
WARN[2018-04-02T14:13:48.426373661-07:00] Your kernel does not support swap memory limit 
WARN[2018-04-02T14:13:48.426433262-07:00] Your kernel does not support cgroup rt period 
WARN[2018-04-02T14:13:48.426454828-07:00] Your kernel does not support cgroup rt runtime 
INFO[2018-04-02T14:13:48.432054818-07:00] Loading containers: start.                   
WARN[2018-04-02T14:13:48.432743843-07:00] Running modprobe bridge br_netfilter failed with message: , error: exec: "modprobe": executable file not found in $PATH 
WARN[2018-04-02T14:13:48.432807947-07:00] Running modprobe nf_nat failed with message: ``, error: exec: "modprobe": executable file not found in $PATH 
WARN[2018-04-02T14:13:48.432834605-07:00] Running modprobe xt_conntrack failed with message: ``, error: exec: "modprobe": executable file not found in $PATH 
Error starting daemon: Error initializing network controller: error obtaining controller instance: failed to create NAT chain: Iptables not found

What’s the best way to get this up and running (preferably with habitat packages) with a minimal amount of fussing with configuration

At the moment our core/docker package isn’t written to be a fully running “service” package, so I’d highly recommend using your operating system’s Docker package/service. We do use the core/docker's docker program in the exporters which would communicate to the Docker Engine so there is a chance of API version incompatibility–but our hedge on this is to try and keep our Docker package up-to-date and recommend users do the same for their Docker Engine.

1 Like

Thanks, @fnichol! That’s good to know. I ended up following these instructions for installing Docker CE on Ubuntu and it was relatively painless. Confirmed that it worked for running the exporter.