Skip to content
This repository has been archived by the owner on May 12, 2021. It is now read-only.

Run docker in kata container #358

Closed
svarlamov opened this issue Jun 1, 2018 · 114 comments
Closed

Run docker in kata container #358

svarlamov opened this issue Jun 1, 2018 · 114 comments
Labels
feature New functionality

Comments

@svarlamov
Copy link

Description of problem

Tried using the https://hub.docker.com/r/hyperhq/docker-in-hyper/ image and instructions, however, it seems to fail due to a missing filesystem driver in the kernel (don't have aufs, overlay, or overlay2 in the container)

Expected result

I believe that a "docker-in-kata" use case should function -- ideally without having to supply the privileged flag -- similar to hyper containers. This is really critical for running docker in our CI/CD, etc.

Actual result

All of these are running with kata-runtime 1.0:

root@katadev-01:~# docker run -it --rm -P --privileged hyperhq/docker-in-hyper
WARN[0000] [!] DON'T BIND ON ANY IP ADDRESS WITHOUT setting -tlsverify IF YOU DON'T KNOW WHAT YOU'RE DOING [!] 
INFO[0000] libcontainerd: new containerd process, pid: 26 
ERRO[0001] devmapper: Udev sync is not supported. This will lead to data loss and unexpected behavior. Install a more recent version of libdevmapper or select a different storage driver. For more information, see https://docs.docker.com/engine/reference/commandline/daemon/#daemon-storage-driver-option 
ERRO[0001] 'overlay' not found as a supported filesystem on this host. Please ensure kernel is new enough and has overlay support loaded. 
FATA[0001] Error starting daemon: invalid argument      
root@katadev-01:~#

AND

root@katadev-01:~# docker run -it --privileged docker:dind
WARN[2018-06-01T02:04:45.951057616Z] could not change group /var/run/docker.sock to docker: group docker not found 
WARN[2018-06-01T02:04:45.957701238Z] [!] DON'T BIND ON ANY IP ADDRESS WITHOUT setting --tlsverify IF YOU DON'T KNOW WHAT YOU'RE DOING [!] 
INFO[2018-06-01T02:04:45.976487211Z] libcontainerd: started new docker-containerd process  pid=13
INFO[0000] starting containerd                           module=containerd revision=773c489c9c1b21a6d78b5c538cd395416ec50f88 version=v1.0.3
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"
WARN[0000] failed to load plugin io.containerd.metadata.v1.bolt  error="invalid argument" module=containerd
INFO[0000] loading plugin "io.containerd.differ.v1.walking"...  module=containerd type=io.containerd.differ.v1
WARN[0000] failed to load plugin io.containerd.differ.v1.walking  error="invalid argument" module=containerd
INFO[0000] loading plugin "io.containerd.gc.v1.scheduler"...  module=containerd type=io.containerd.gc.v1
WARN[0000] failed to load plugin io.containerd.gc.v1.scheduler  error="invalid argument" module=containerd
INFO[0000] loading plugin "io.containerd.grpc.v1.containers"...  module=containerd type=io.containerd.grpc.v1
WARN[0000] failed to load plugin io.containerd.grpc.v1.containers  error="invalid argument" module=containerd
INFO[0000] loading plugin "io.containerd.grpc.v1.content"...  module=containerd type=io.containerd.grpc.v1
WARN[0000] failed to load plugin io.containerd.grpc.v1.content  error="invalid argument" module=containerd
INFO[0000] loading plugin "io.containerd.grpc.v1.diff"...  module=containerd type=io.containerd.grpc.v1
WARN[0000] failed to load plugin io.containerd.grpc.v1.diff  error="could not load required differ due plugin init error: walking: invalid argument" module=containerd
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
WARN[0000] failed to load plugin io.containerd.grpc.v1.images  error="invalid argument" module=containerd
INFO[0000] loading plugin "io.containerd.grpc.v1.leases"...  module=containerd type=io.containerd.grpc.v1
WARN[0000] failed to load plugin io.containerd.grpc.v1.leases  error="invalid argument" module=containerd
INFO[0000] loading plugin "io.containerd.grpc.v1.namespaces"...  module=containerd type=io.containerd.grpc.v1
WARN[0000] failed to load plugin io.containerd.grpc.v1.namespaces  error="invalid argument" module=containerd
INFO[0000] loading plugin "io.containerd.grpc.v1.snapshots"...  module=containerd type=io.containerd.grpc.v1
WARN[0000] failed to load plugin io.containerd.grpc.v1.snapshots  error="invalid argument" module=containerd
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
WARN[0000] failed to load plugin io.containerd.runtime.v1.linux  error="invalid argument" module=containerd
INFO[0000] loading plugin "io.containerd.grpc.v1.tasks"...  module=containerd type=io.containerd.grpc.v1
WARN[0000] failed to load plugin io.containerd.grpc.v1.tasks  error="invalid argument" module=containerd
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.078145s   module=containerd
ERRO[2018-06-01T02:04:46.237294234Z] 'overlay' not found as a supported filesystem on this host. Please ensure kernel is new enough and has overlay support loaded.  storage-driver=overlay2
ERRO[2018-06-01T02:04:46.300917461Z] 'overlay' not found as a supported filesystem on this host. Please ensure kernel is new enough and has overlay support loaded.  storage-driver=overlay
ERRO[2018-06-01T02:04:46.301453650Z] Failed to built-in GetDriver graph devicemapper /var/lib/docker 
Error starting daemon: error while opening volume store metadata database: invalid argument
root@katadev-01:~#

I can't find the kata-collect-data.sh script on my machine and running it directly from github source with bash fails... I installed kata via the debian package for Ubuntu 16.04

@egernst
Copy link
Member

egernst commented Jun 1, 2018

Thanks for the issue, @svarlamov. In this case, its s because the default kernel provided by docker doesn't have these configs enabled, AFAICT. We do provide a method for building your own and specifying a custom kernel. It seems to me that this should meet your needs. Or at least get you past this issue!

We don't enable "everything" by default, as for most the current config works and added features just impact potential density for all.

@svarlamov
Copy link
Author

@egernst Thank you for the explanation -- will build my own kernel then. Thanks!

@m-barthelemy
Copy link

m-barthelemy commented Jun 3, 2018

I had/have the same issue. I've been able to start dockerd in a kata container after doing the following:

"storage-driver": "devicemapper",
    "storage-opts": [
      "dm.directlvm_device=/dev/data/katana",
      "dm.thinp_percent=95",
      "dm.thinp_metapercent=2",
      "dm.thinp_autoextend_threshold=80",
      "dm.thinp_autoextend_percent=20",
      "dm.directlvm_device_force=false"
  ]
  • Start my container hosting the nested Docker with specific options. In particular, for the Netfilter stuff, iptables calls the modprobe command, even if I compiled the modules statically. modprobe requires access to lib/modules/kernel_release/modules.builtin generated during custom kernel build. Also, I had to grant more capabilities to the container:
docker run -it --cap-add=NET_ADMIN --cap-add=SYS_ADMIN --cap-add=SYS_RESOURCE --security-opt apparmor=unconfined -v ./modules.builtin.4.14.22:/lib/modules/4.14.22/modules.builtin alpine sh
  • Within the container, generate modules.dep from the mounted modules.builtin:
depmod -ae

(This step can probably be done from the host where the kernel was compiled, and modules.dep be mounted like modules.builtin).

  • Still within the container:
mount -o remount,rw /proc/sys
umount /proc/keys /proc/timer_list /proc/sched_debug /proc/sched_debug /proc/scsi /proc/irq /proc/sys /proc/bus /proc/fs

Then install Docker-ce, and run the daemon:

dockerd

Now, it starts. But I cannot run any container, it always fail with

docker: Error response from daemon: cgroups: cannot find cgroup mount destination: unknown.

Would it be possible to have an option in kata-runtime for skipping any custom setup it does related to procfs and cgroups? It would boot the kernel and leave these untouched, which should make the kata container behave more like a regular VM.

@svarlamov
Copy link
Author

@m-barthelemy Thank you for your explanation! I haven't had a chance to dig much deeper into this yet -- have you gotten the procfs and cgroups stuff sorted?

@svarlamov
Copy link
Author

Also wondering here -- it seems that we're trying to really docker in docker, as opposed to connecting to the daemon at the VM level via a shared sock/tcp. Is there any possibility of that? Does it even make sense?

@kfox1111
Copy link

I really would like this function out of mainline too. One of the long outstanding issues in the community is integrating container building in a secure way. You can see all sorts of docs like: https://docs.gitlab.com/ee/ci/docker/using_docker_build.html where there are lots of different ways to deploy it, each with their major drawbacks. There just isn't a good solution currently.

But some way to give a kata container to a user while giving them privilege would allow it to start fast, run fast, and get torn down quickly while still providing security via vm level isolation would be awesome.

Alternately, buildah seems to be maturing rapidly and might not need as much from the runtime as docker may. So maybe at least getting that tool up to snuff in kata might work too.

@svarlamov
Copy link
Author

@egernst Since you have a bit more background on this proj, are you able to share a brief outline of what changes are likely required to make this happen?

@enzian
Copy link

enzian commented Jun 26, 2018

hey @svarlamov @egernst , I'd be really interested in a little more information on how to get this use-case to work!
I attempted to get this to work by building my own gust kernel with overlay-fs support enabled - but still no luck, dockerd does not start... (I used the default `docker/dind`` images)
So any Information on what I'm missing is dearly welcome :-)

@jodh-intel
Copy link
Contributor

Hi @enzian - Could you paste the error you get?


It seems the issue you are all seeing is that the guest environment is not providing sufficient functionality to run docker. That isn't surprising given we try to keep it as minimal as possible. But that said, we're considering ways to provide for the myriad features/services folk need.

A thought has occurred to me: lxc (like docker) creates Linux containers. But lxc (unlike docker afaik) provides a really useful command (lxc-checkconfig) you can run to determine if your system is capable of creating an lxc container.

As such, although it's not guaranteed to help your run a docker container, trying something like the following might be enlightening:

$ sudo docker run -ti ubuntu sh
# apt-get update && apt-get -y install lxc
# lxc-checkconfig

ftr, I just tried this, but the command needs to be able to find the kernel config. That either means you'll have to make /proc/config.gz available to the Ubuntu environment, or you'll have to enable a debug console to run that lxc command in the root level guest namespace:

Related:

@enzian
Copy link

enzian commented Jun 26, 2018

currently this is where I am:

WARN[2018-06-26T11:21:07.176131843Z] could not change group /var/run/docker.sock to docker: group docker not found
INFO[2018-06-26T11:21:07.183109507Z] libcontainerd: started new docker-containerd process  pid=10
INFO[0000] starting containerd                           module=containerd revision=773c489c9c1b21a6d78b5c538cd395416ec50f88 version=v1.0.3
ERRO[0000] failed to change OOM score to -500            error="write /proc/10/oom_score_adj: permission denied" 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=containe
rd
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"
WARN[0000] failed to load plugin io.containerd.metadata.v1.bolt  error="invalid argument" module=containerd
INFO[0000] loading plugin "io.containerd.differ.v1.walking"...  module=containerd type=io.containerd.differ.v1
WARN[0000] failed to load plugin io.containerd.differ.v1.walking  error="invalid argument" module=containerd
INFO[0000] loading plugin "io.containerd.gc.v1.scheduler"...  module=containerd type=io.containerd.gc.v1
WARN[0000] failed to load plugin io.containerd.gc.v1.scheduler  error="invalid argument" module=containerd
INFO[0000] loading plugin "io.containerd.grpc.v1.containers"...  module=containerd type=io.containerd.grpc.v1
WARN[0000] failed to load plugin io.containerd.grpc.v1.containers  error="invalid argument" module=containerd
INFO[0000] loading plugin "io.containerd.grpc.v1.content"...  module=containerd type=io.containerd.grpc.v1
WARN[0000] failed to load plugin io.containerd.grpc.v1.content  error="invalid argument" module=containerd
INFO[0000] loading plugin "io.containerd.grpc.v1.diff"...  module=containerd type=io.containerd.grpc.v1
WARN[0000] failed to load plugin io.containerd.grpc.v1.diff  error="could not load required differ due plugin init error: walking: invalid argument" module=containerd
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
WARN[0000] failed to load plugin io.containerd.grpc.v1.images  error="invalid argument" module=containerd
INFO[0000] loading plugin "io.containerd.grpc.v1.leases"...  module=containerd type=io.containerd.grpc.v1
WARN[0000] failed to load plugin io.containerd.grpc.v1.leases  error="invalid argument" module=containerd
INFO[0000] loading plugin "io.containerd.grpc.v1.namespaces"...  module=containerd type=io.containerd.grpc.v1
WARN[0000] failed to load plugin io.containerd.grpc.v1.namespaces  error="invalid argument" module=containerd
INFO[0000] loading plugin "io.containerd.grpc.v1.snapshots"...  module=containerd type=io.containerd.grpc.v1
WARN[0000] failed to load plugin io.containerd.grpc.v1.snapshots  error="invalid argument" module=containerd
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
WARN[0000] failed to load plugin io.containerd.runtime.v1.linux  error="invalid argument" module=containerd
INFO[0000] loading plugin "io.containerd.grpc.v1.tasks"...  module=containerd type=io.containerd.grpc.v1
WARN[0000] failed to load plugin io.containerd.grpc.v1.tasks  error="invalid argument" module=containerd
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.060983s   module=containerd
Error starting daemon: error while opening volume store metadata database: invalid argument

@jodh-intel
Copy link
Contributor

Thanks @enzian - a few things jump out:

  • you either need to add support for btrfs, or stop docker trying to use it ;)
  • you need to create a docker group.
  • writing to /proc/self/oom_score_adj works, but not if the number is negative as docker seems to be trying to do.

@jodh-intel
Copy link
Contributor

By the way guys, are you running docker in debug mode? I don't see any debug messages in the log snippets so I suspect you aren't. Enabling might give more clues :)

@enzian
Copy link

enzian commented Jun 26, 2018

ok, patched in btrfs, mounted modules.builtin added a group named docker ahead of running dockerd --oom-score-adjust 500 and got:

INFO[2018-06-26T13:11:19.705657148Z] libcontainerd: started new docker-containerd process  pid=56
INFO[0000] starting containerd                           module=containerd revision=773c489c9c1b21a6d78b5c538cd395416ec50f88 version=v1.0.3
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=containe
rd
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"
WARN[0000] failed to load plugin io.containerd.metadata.v1.bolt  error="invalid argument" module=containerd
INFO[0000] loading plugin "io.containerd.differ.v1.walking"...  module=containerd type=io.containerd.differ.v1
WARN[0000] failed to load plugin io.containerd.differ.v1.walking  error="invalid argument" module=containerd
INFO[0000] loading plugin "io.containerd.gc.v1.scheduler"...  module=containerd type=io.containerd.gc.v1
WARN[0000] failed to load plugin io.containerd.gc.v1.scheduler  error="invalid argument" module=containerd
INFO[0000] loading plugin "io.containerd.grpc.v1.containers"...  module=containerd type=io.containerd.grpc.v1
WARN[0000] failed to load plugin io.containerd.grpc.v1.containers  error="invalid argument" module=containerd
INFO[0000] loading plugin "io.containerd.grpc.v1.content"...  module=containerd type=io.containerd.grpc.v1
WARN[0000] failed to load plugin io.containerd.grpc.v1.content  error="invalid argument" module=containerd
INFO[0000] loading plugin "io.containerd.grpc.v1.diff"...  module=containerd type=io.containerd.grpc.v1
WARN[0000] failed to load plugin io.containerd.grpc.v1.diff  error="could not load required differ due plugin init error: walking: invalid argument" module=containerd
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
WARN[0000] failed to load plugin io.containerd.grpc.v1.images  error="invalid argument" module=containerd
INFO[0000] loading plugin "io.containerd.grpc.v1.leases"...  module=containerd type=io.containerd.grpc.v1
WARN[0000] failed to load plugin io.containerd.grpc.v1.leases  error="invalid argument" module=containerd
INFO[0000] loading plugin "io.containerd.grpc.v1.namespaces"...  module=containerd type=io.containerd.grpc.v1
WARN[0000] failed to load plugin io.containerd.grpc.v1.namespaces  error="invalid argument" module=containerd
INFO[0000] loading plugin "io.containerd.grpc.v1.snapshots"...  module=containerd type=io.containerd.grpc.v1
WARN[0000] failed to load plugin io.containerd.grpc.v1.snapshots  error="invalid argument" module=containerd
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
WARN[0000] failed to load plugin io.containerd.runtime.v1.linux  error="invalid argument" module=containerd
INFO[0000] loading plugin "io.containerd.grpc.v1.tasks"...  module=containerd type=io.containerd.grpc.v1
WARN[0000] failed to load plugin io.containerd.grpc.v1.tasks  error="invalid argument" module=containerd
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.060515s   module=containerd
INFO[2018-06-26T13:11:19.813457318Z] [graphdriver] using prior storage driver: overlay2
Error starting daemon: error while opening volume store metadata database: invalid argument

@jodh-intel
Copy link
Contributor

Hi @enzian - great - definite progress there :) It might be worth keeping a gist of how you did what you did.

Did you enable debug as I still don't see any DEBUG-level messages in the above?

@enzian
Copy link

enzian commented Jun 26, 2018

sorry, for that @jodh-intel one more with debug logs:

# dockerd --oom-score-adjust 500 --log-level debug
DEBU[2018-06-26T13:56:29.055959879Z] Listener created for HTTP on unix (/var/run/docker.sock)
INFO[2018-06-26T13:56:29.060197970Z] libcontainerd: started new docker-containerd process  pid=45
INFO[0000] starting containerd                           module=containerd revision=773c489c9c1b21a6d78b5c538cd395416ec50f88 version=v1.0.3
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=containe
rd
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"
WARN[0000] failed to load plugin io.containerd.metadata.v1.bolt  error="invalid argument" module=containerd
INFO[0000] loading plugin "io.containerd.differ.v1.walking"...  module=containerd type=io.containerd.differ.v1
WARN[0000] failed to load plugin io.containerd.differ.v1.walking  error="invalid argument" module=containerd
INFO[0000] loading plugin "io.containerd.gc.v1.scheduler"...  module=containerd type=io.containerd.gc.v1
WARN[0000] failed to load plugin io.containerd.gc.v1.scheduler  error="invalid argument" module=containerd
INFO[0000] loading plugin "io.containerd.grpc.v1.containers"...  module=containerd type=io.containerd.grpc.v1
WARN[0000] failed to load plugin io.containerd.grpc.v1.containers  error="invalid argument" module=containerd
INFO[0000] loading plugin "io.containerd.grpc.v1.content"...  module=containerd type=io.containerd.grpc.v1
WARN[0000] failed to load plugin io.containerd.grpc.v1.content  error="invalid argument" module=containerd
INFO[0000] loading plugin "io.containerd.grpc.v1.diff"...  module=containerd type=io.containerd.grpc.v1
WARN[0000] failed to load plugin io.containerd.grpc.v1.diff  error="could not load required differ due plugin init error: walking: invalid argument" module=containerd
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
WARN[0000] failed to load plugin io.containerd.grpc.v1.images  error="invalid argument" module=containerd
INFO[0000] loading plugin "io.containerd.grpc.v1.leases"...  module=containerd type=io.containerd.grpc.v1
WARN[0000] failed to load plugin io.containerd.grpc.v1.leases  error="invalid argument" module=containerd
INFO[0000] loading plugin "io.containerd.grpc.v1.namespaces"...  module=containerd type=io.containerd.grpc.v1
WARN[0000] failed to load plugin io.containerd.grpc.v1.namespaces  error="invalid argument" module=containerd
INFO[0000] loading plugin "io.containerd.grpc.v1.snapshots"...  module=containerd type=io.containerd.grpc.v1
WARN[0000] failed to load plugin io.containerd.grpc.v1.snapshots  error="invalid argument" module=containerd
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
WARN[0000] failed to load plugin io.containerd.runtime.v1.linux  error="invalid argument" module=containerd
INFO[0000] loading plugin "io.containerd.grpc.v1.tasks"...  module=containerd type=io.containerd.grpc.v1
WARN[0000] failed to load plugin io.containerd.grpc.v1.tasks  error="invalid argument" module=containerd
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.024696s   module=containerd
DEBU[2018-06-26T13:56:29.105001716Z] Golang's threads limit set to 14310
DEBU[2018-06-26T13:56:29.109639616Z] processing event stream                       module=libcontainerd namespace=plugins.moby
DEBU[2018-06-26T13:56:29.111562933Z] Using default logging driver json-file
DEBU[2018-06-26T13:56:29.112648560Z] [graphdriver] priority list: [btrfs zfs overlay2 aufs overlay devicemapper vfs]
DEBU[2018-06-26T13:56:29.119353124Z] backingFs=extfs,  projectQuotaSupported=false  storage-driver=overlay2
INFO[2018-06-26T13:56:29.119389092Z] [graphdriver] using prior storage driver: overlay2
DEBU[2018-06-26T13:56:29.119402452Z] Initialized graph driver overlay2
DEBU[2018-06-26T13:56:29.128428824Z] Cleaning up old mountid : start.
Error starting daemon: error while opening volume store metadata database: invalid argument

It does not leave me any smarted ... ;-)

@enzian
Copy link

enzian commented Jun 26, 2018

oh, and a gist of how I got it this situation :p

@jodh-intel
Copy link
Contributor

Thanks @enzian. The error at the end is coming from boltdb:

A quick test shows that bolt.Open() is failing on an mmap(MAP_SHARED):

255   mmap(NULL, 32768, PROT_READ, MAP_SHARED, 3, 0) = -1 EINVAL (Invalid argument)

That I think is:

What might be worth exploring is a rootPath set to "":

/cc @sboeuf, @grahamwhaley.

@grahamwhaley
Copy link
Contributor

Ah, we've seen a BoltDB issue under VM containers before - so, this may not be specific to docker-under-kata. We wanted to add it to our 'popular images test', but it looks like there was no image.
Ah, see also: clearcontainers/runtime#523

I think really @mcastelino and @egernst are the folks to ask, but both are unavailable right now I think for comment.

@jodh-intel
Copy link
Contributor

@GabyCT
Copy link
Contributor

GabyCT commented Jun 26, 2018

@jodh-intel no, I think that we were looking for boltdb official release at docker hub

@GabyCT
Copy link
Contributor

GabyCT commented Jun 26, 2018

@jodh-intel, I tried the image from https://hub.docker.com/r/rossriley/docker-bolt/ but I do not think that is what we are looking for as a replacement for boltdb. The image https://hub.docker.com/r/rossriley/docker-bolt/ does not have go , bolt or boltd.

@kfox1111
Copy link

interesting... clearcontainers/runtime#852 implies its a lack of feature in 9p.

Is there any workarounds we could do? emptyDir maybe? Is every file system passed through 9p?

@kfox1111
Copy link

buildah-bud might be a workaround here too, as it may not use boltdb.

@grahamwhaley
Copy link
Contributor

Hi @kfox1111 . All filesystem maps from the VM to the host are via 9p unless you use a graph driver on the host that supports block device mode, and then Kata can map that block mount directly into the VM. I thought we had an Issue open asking for us to document how you enable that (@amshinde - are you willing to write that up - how to set up and use block devices with kata?) Using a block backed graph driver might work @kfox1111 . You'll need I believe to use devicemapper as the graph driver on the host.
Another route we have used inside containers is to use a RAMFS/TMPFS inside the container. We used to just mount a TMPFS, but we have locked down the containers a bit more now, so you are not normally allowed to mount inside the container - one workaround you can see here was to set the TMPDIR to the /dev/shm path for instance ;-) . That will also depend on if dind can run with that data held only inside the container, and not mapped back onto the host?

@grahamwhaley
Copy link
Contributor

@jodh-intel, @egernst @WeiZhang555 @sboeuf - I think we should add any known 9p limitations to the limitations doc - wdyt?

@amshinde
Copy link
Member

@grahamwhaley I had added some documentation for block storage for virtcontainers library itself:
https://github.com/kata-containers/runtime/tree/master/virtcontainers#storage.
But I think that needs to be moved somewhere more accessible, with some more details added in.
I'll get that done today.

@enzian
Copy link

enzian commented Jun 27, 2018

@grahamwhaley I tried your approach to use devicemapper as dockers storage driver:

  1. Append "storage-driver": "devicemapper" to /etc/docker/daemon.json.
  2. Run the container: sudo docker run --rm -it -v ${tmpdir}/linux-${kernel_version}/modules.builtin:/lib/modules/4.14.22/modules.builtin docker:dind sh
  3. From within the container, add the docker group: addgroup -S -g 1000 docker
  4. Start the docker daemon: dockerd --oom-score-adjust 500 --log-level debug

but nothing changed:

DEBU[2018-06-27T06:42:04.879906182Z] Listener created for HTTP on unix (/var/run/docker.sock)
INFO[2018-06-27T06:42:04.884528932Z] libcontainerd: started new docker-containerd process  pid=11
INFO[0000] starting containerd                           module=containerd revision=773c489c9c1b21a6d78b5c538cd395416ec50f88 version=v1.0.3
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.containe
rd.metadata.v1.bolt"
WARN[0000] failed to load plugin io.containerd.metadata.v1.bolt  error="invalid argument" module=containerd
INFO[0000] loading plugin "io.containerd.differ.v1.walking"...  module=containerd type=io.containerd.differ.v1
WARN[0000] failed to load plugin io.containerd.differ.v1.walking  error="invalid argument" module=containerd
INFO[0000] loading plugin "io.containerd.gc.v1.scheduler"...  module=containerd type=io.containerd.gc.v1
WARN[0000] failed to load plugin io.containerd.gc.v1.scheduler  error="invalid argument" module=containerd
INFO[0000] loading plugin "io.containerd.grpc.v1.containers"...  module=containerd type=io.containerd.grpc.v1
WARN[0000] failed to load plugin io.containerd.grpc.v1.containers  error="invalid argument" module=containerd
INFO[0000] loading plugin "io.containerd.grpc.v1.content"...  module=containerd type=io.containerd.grpc.v1
WARN[0000] failed to load plugin io.containerd.grpc.v1.content  error="invalid argument" module=containerd
INFO[0000] loading plugin "io.containerd.grpc.v1.diff"...  module=containerd type=io.containerd.grpc.v1
WARN[0000] failed to load plugin io.containerd.grpc.v1.diff  error="could not load required differ due plugin init error: walking: invalid argument" module=containerd
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
WARN[0000] failed to load plugin io.containerd.grpc.v1.images  error="invalid argument" module=containerd
INFO[0000] loading plugin "io.containerd.grpc.v1.leases"...  module=containerd type=io.containerd.grpc.v1
WARN[0000] failed to load plugin io.containerd.grpc.v1.leases  error="invalid argument" module=containerd
INFO[0000] loading plugin "io.containerd.grpc.v1.namespaces"...  module=containerd type=io.containerd.grpc.v1
WARN[0000] failed to load plugin io.containerd.grpc.v1.namespaces  error="invalid argument" module=containerd
INFO[0000] loading plugin "io.containerd.grpc.v1.snapshots"...  module=containerd type=io.containerd.grpc.v1
WARN[0000] failed to load plugin io.containerd.grpc.v1.snapshots  error="invalid argument" module=containerd
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
WARN[0000] failed to load plugin io.containerd.runtime.v1.linux  error="invalid argument" module=containerd
INFO[0000] loading plugin "io.containerd.grpc.v1.tasks"...  module=containerd type=io.containerd.grpc.v1
WARN[0000] failed to load plugin io.containerd.grpc.v1.tasks  error="invalid argument" module=containerd
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.081603s   module=containerd
DEBU[2018-06-27T06:42:05.027178985Z] Golang's threads limit set to 14310
DEBU[2018-06-27T06:42:05.046806952Z] processing event stream                       module=libcontainerd namespace=plugins.moby
DEBU[2018-06-27T06:42:05.057989341Z] Using default logging driver json-file
DEBU[2018-06-27T06:42:05.062461103Z] [graphdriver] priority list: [btrfs zfs overlay2 aufs overlay devicemapper vfs]
DEBU[2018-06-27T06:42:05.065507881Z] cannot open /dev/zfs: open /dev/zfs: no such file or directory  storage-driver=zfs
DEBU[2018-06-27T06:42:05.084589779Z] backingFs=extfs,  projectQuotaSupported=false  storage-driver=overlay2
DEBU[2018-06-27T06:42:05.085792363Z] Initialized graph driver overlay2
DEBU[2018-06-27T06:42:05.112173884Z] Cleaning up old mountid : start.
Error starting daemon: error while opening volume store metadata database: invalid argument

@grahamwhaley
Copy link
Contributor

I'm not set up here to try out devicemapper - @amshinde , can I ask you to have a look at this output to see if there is anything obvious?
@enzian - can you run a mount inside the container and paste the output here - I believe we should see the filesystems mounted as block devices (when using devicemapper), rather than as 9p mounts - let's check that as a first step to ensure the host side devicemapper got enabled and picked up by the Kata runtime...

@marcov
Copy link
Contributor

marcov commented Nov 16, 2018

might it be my processor being too old?

WARN[0000] kernel module parameter has unexpected value  arch=amd64 description="Intel KVM" expected=Y name=kvm_intel parameter=nested pid=1599 source=runtime type=module value=N

Nested mode is only needed if you want to get yet another level of nesting, and it is not required on the system where you have katacontainers installed (i.e., on the system where you run docker run --runtime=kata-runtime ...).
Given your config, you should be able to run containers using kata.

@jodh-intel
Copy link
Contributor

@enzian - please could you:

  1. Enable full debug,
  2. Re-run the failing docker command.
  3. Run sudo kata-collect-data.sh.
  4. Review the output of the above script and if it doesn't contain anything sensitive, paste the output into this issue as a comment. Part of the report will show errors which might give us more of a clue.

@jodh-intel
Copy link
Contributor

@enzian - it would also obviously be useful if you could try running on a baremetal system without hyper-v for comparative purposes ;)

@enzian
Copy link

enzian commented Nov 20, 2018

ok, well we found our problem. The ESX-Cluster we had did not support unrestricted guests - migrated the hosts and it works!

@caoruidong
Copy link
Member

Cheers!

@enzian
Copy link

enzian commented Nov 22, 2018

I think we can close this issue now, right?

@jodh-intel
Copy link
Contributor

@enzian - nice! 😄

@svarlamov - have you managed to recreate @enzian's results?

It might be useful to summarise what is required and document this somewhere (since this is a very long issue :)

@enzian
Copy link

enzian commented Nov 23, 2018

@jodh-intel - I will try to run a kublet in combination with a DinD container. This I will document and contribute the how-to to the kata-project. Is this something that would be welcome?

@scher200
Copy link

@enzian looking forward to your docs

@bajacondor
Copy link

Hello, and good work with all this. I'm curious to see the documentation. I have a docker:dind image running with the kata-runtime, but it hangs when building dockerfiles. When starting the dockerd, I also get errors about the overlay storage-driver:
ERRO[2019-02-26T23:42:57.805555497Z] 'overlay' not found as a supported filesystem on this host. Please ensure kernel is new enough and has overlay support loaded. storage-driver=overlay
I'm guessing I need to build the kernel image with non-default flags. Is there any progress on the documentation around this issue?

Thank you!!

@jcvenegas
Copy link
Member

@bajacondor you mean documentation on how to build your kernel?

@bajacondor
Copy link

Hi @jcvenegas, I was hoping for documentation around running docker in docker or building with docker within a kata container.

@daniel-noland
Copy link

Just as an FYI here, I managed to make docker in kata work. I have written up some basic documentation on how this was done here. I also provide a containerized build for the whole thing (which I tried to make portable, even if you don't have kata installed).

I would appreciate any feedback on my approach (curious to know if it works / is useful for anyone else). I will improve the quick docs and add a few other features tomorrow if I get time after work.

Thanks to everyone for their work on this issue :)

@grahamwhaley
Copy link
Contributor

Wow @daniel-noland - triple nested!!! (kata-in-docker and docker-in-kata in the same stackup!).
I had a quick skim through your link, and it looked OK to me. Yes, it'd be great if we could get some official docs PR'd into the kata repos - ideally for both kata-in-docker and docker-in-kata setups.

@daniel-noland
Copy link

daniel-noland commented Nov 26, 2019

Thanks @grahamwhaley, I appreciate that.

If it is useful I would be happy to do a more complete write up / walkthrough on both docker-in-kata and kata-in-docker. Not sure when I can have that done but I think that kata-in-docker in particular is a cool way to test out kata-containers without the need to mess with (and potentially break) a new user's containerization setup. I imagine that a three line "try it out risk free" could help the project grow.

That said, I should likely wait for a few people to try out the current approach. It works on my machine but that doesn't mean much. Also, I am not sure how amenable the kata-containers project would be to enabling any or all of the kernel features I turned on to make docker-in-kata work. I really respect how minimal the current kata kernel build is. If any changes derived from my work were to be accepted I assume I would need to

  1. get this working on the 4.19 kernel (should be easy),
  2. find and document the minimum set of kernel features strictly necessary to run nested docker (I didn't want to rebuild a million times so I just turned on basically all of the nf_tables / nat / netfilter features),
  3. determine if we actually want to include btrfs support (I found docker build to be completely broken with the 9p / overlay approach but that doesn't mean we must use btrfs),
  4. write some real docs (my stream of thought notes are likely not quite good enough 🤓),
  5. write some tests.

I am happy to do any and all of that, I would just want to confirm that there is interest first 😸.

I also just wrote up a quick future plans section with some details of other things I would like to try. I would be interested to know of other people's use cases for docker-in-kata or kata-in-docker. My focus is on networking and distributed systems but I am sure other people have different goals we might want to account for.

Again, thanks to everyone for all their hard work on kata-containers. I have really enjoyed playing with this project 😃

@haslersn
Copy link

I was trying to run Docker in Kata. I tried two approaches in order to prevent getting the error failed to start daemon: error initializing graphdriver: driver not supported.

  1. Using the vfs storage driver.
  2. Using the overlay2 storage driver and mounting a tmpfs on /var/lib/docker/overlay2.

With both approaches I don't get above error and the docker daemon starts successfully.

/ # docker pull nginx
Using default tag: latest
latest: Pulling from library/nginx
Digest: sha256:8e10956422503824ebb599f37c26a90fe70541942687f70bbdb744530fc9eba4
Status: Image is up to date for nginx:latest
docker.io/library/nginx:latest

However, I can't run containers. Equally with both approaches, I get the following error:

/ # docker run nginx
docker: Error response from daemon: cgroups: cannot find cgroup mount destination: unknown.

Does anybody have an idea how to fix this?

Additional information

  • Image: docker.io/library/docker:19-dind
  • Image ID: docker.io/library/docker@sha256:3f102649d944f417085acce09362927f8a6371c919c044ff1176d5c4c007f351
  • Docker version inside Kata container:
    / # docker --version
    Docker version 19.03.15, build 99e3ed8
    

@haslersn
Copy link

After reading this, I found out that Docker in Kata works for me after executing the following commands in the container:

mkdir /sys/fs/cgroup/systemd
mount -t cgroup -o none,name=systemd cgroup /sys/fs/cgroup/systemd

Is there a way to start a Kata Container on Kubernetes with that mount already present?

@haslersn
Copy link

haslersn commented Apr 7, 2021

@jodh-intel Why is this closed?

I think in order to get overlay filesystems working, you need to use kernel 5.6 or higher and add "-o", "xattr" to virtio_fs_extra_args. Is there some documentation on this?

Furthermore, it is unclear to me why this workaround is required. And it's just a workaround: ideally the dind container should work out of the box without supplying a custom entrypoint.

@fidencio
Copy link
Member

fidencio commented Apr 7, 2021

@haslersn, please, see http://lists.katacontainers.io/pipermail/kata-dev/2021-April/001819.html, there you'll find the explanation why the issue was closed.

@fidencio
Copy link
Member

fidencio commented Apr 7, 2021

Hi All,

# TL;DR

We're closing all open GitHub issues for Kata 1.x and 2.x that were created before 1st June 2020.


# Background 

We have too many old open issues that are making it hard to identify the reallly important newer ones.

# Plan

Since a lot of those issues are now probably "stale", we intend to close all open GitHub issues opened before 1 June 2020.

# When?

This week some time.

# Why?

Closing these old issues will:

- Allow us to better manage the more recent issues

  We're in the process of categorising current issues with labels to allow us to manage the backlog more efficiently).

- Act as a forcing function for those who raised the issue

  The originator will get notified when the issue is closed, which will remind them of the issue and the problem. And if the issue is still important, they can re-open it with a single click.

# What is the impact of closing an issue?

Whether a GitHub issue is open or closed is simply a state field - you can open and close an issue as many times as you like: no information is going to be lost by changing the issue state to closed. By closing the old issues, we'll hopefully get the list of relevant open issues down to a more manageable number. And once labelled, will allow us to concentrate on fixing the issues rather than spending lots of time managing the issues themselves.

Of course, if an issue is closed, it's highly unlikely anyone will be working on resolving it, so...

# If one of your issues is closed

As mentioned above, if one of your issues is closed, please consider whether you are happy with this. If you think the issue should remain open, just click the "reopen" button and add a comment for us. It would be helpful if you could also mention whether the problem still exists with the latest 2.x version of Kata.

# Get involved

If you're interested in helping us manage the isue backlog, please get in contact [1], and maybe consider volunteering to help on the Kata rota [2].

Cheers,

James

[1] - https://github.com/kata-containers/community/blob/master/README.md#join-us
[2] - https://github.com/kata-containers/community/wiki/Review-Team-Rota

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
feature New functionality
Projects
None yet
Development

No branches or pull requests