hyperhq / runv

Hypervisor-based Runtime for OCI
Apache License 2.0
828 stars 129 forks source link

Does runV support running under containerd 1.0.0 ? #610

Closed allencloud closed 6 years ago

allencloud commented 7 years ago

Hi, Maintainers,

Currently I have experienced running runV under the latest docker-ce with containerd 0.2.3.

While I think the coming milestone release of containerd 1.0.0 has huge differences from container 0.2.3, especially on image side. Docker used to utilize image via dockerd, while in containerd 1.0.0, image handling is taken over by containerd.

I was wondering if you maintainers has experience containerd 1.0.0 's supporting runV ?

also /cc @Ace-Tang who is doing some research on runV and containerd.

Thanks

laijs commented 7 years ago

Yes. it does.

allencloud commented 7 years ago

Thanks for your feedback. @laijs Do you have any guidance of combining runV and containerd (both 0.2.3 and 1.0.0), such as docs ? I have seen some guidance of docker and runV.

laijs commented 7 years ago

https://github.com/hyperhq/runv/blob/master/docs/configure-runv-with-containerd-docker.md#work-with-containerd

allencloud commented 7 years ago

Thanks a lot for your guide. @laijs

Actually I failed to work with latest runv and container 1.0.0.

I followed the instructions and it failed when executing command ctr run --rm -t docker.io/library/busybox:latest foobar2 sh

the result is:

root@ubuntu:~# ctr run --rm -t docker.io/library/busybox:latest foobar2 sh
ctr: OCI runtime create failed: unable to retrieve OCI runtime error (open /run/containerd/io.containerd.runtime.v1.linux/default/foobar2/log.json: no such file or directory): runv did not terminate sucessfully: Unsupported driver ""

NAME:
   runv create - create a container

USAGE:
   runv create [command options] <container-id>

Where "<container-id>" is your name for the instance of the container that you
are creating. The name you provide for the container instance must be unique on
your host.

DESCRIPTION:
   The create command creates an instance of a container for a bundle. The bundle
is a directory with a specification file named "config.json" and a root
filesystem.

The specification file includes an args parameter. The args parameter is used
to specify command(s) that get run when the container is started. To change the
command(s) that get executed on start, edit the args parameter of the spec. See
"runv spec --help" for more explanation.

OPTIONS:
   --bundle value, -b value  path to the root of the bundle directory, defaults to the current directory (default: "/run/containerd/io.containerd.runtime.v1.linux/default/foobar2")
   --console value           specify the pty slave path for use with the container
   --console-socket value    specify the unix socket for sending the pty master back
   --pid-file value          specify the file to write the process id to
   --no-pivot                [ignore on runv] do not use pivot root to jail process inside rootfs.  This should be used whenever the rootfs is on top of a ramdisk

ERROR: logging before flag.Parse: E0928 21:34:15.545996   15343 main.go:149] app.Run(os.Args) failed with err: &errors.errorString{s:"Unsupported driver \"\""}
Unsupported driver ""
: unknown

Could you give me some guidance again towards this case?

Thanks a lot.

bergwolf commented 7 years ago

@allencloud what is your /etc/containerd/config.toml content?

FYI, I am using the following

root = "/var/lib/containerd"
state = "/run/containerd"
subreaper = true
oom_score = 0

[grpc]
  address = "/run/containerd/containerd.sock"
  uid = 0
  gid = 0

[debug]
  address = "/run/containerd/debug.sock"
  uid = 0
  gid = 0
  level = "info"

[metrics]
  address = ""

[cgroup]
  path = ""

[plugins.linux]
  shim = "containerd-shim"
  no_shim = false
  runtime = "runv"
  shim_debug = true

And runv works with latest containerd (https://github.com/containerd/containerd/commit/b24acea276739)

$containerd --version
containerd github.com/containerd/containerd v1.0.0-beta.1-19-gb24acea
$sudo ctr run --rm -t docker.io/library/busybox:latest foobar1 echo foobar1
foobar1
Ace-Tang commented 6 years ago

@allencloud check if you have hyper-initrd.img and kernel under /var/lib/hyper, the error msg is so confused ...

allencloud commented 6 years ago

Thanks for the feedback. @laijs Actually here is my config and binary versions:

root@ubuntu:~# containerd --version
containerd github.com/containerd/containerd v1.0.0-beta.1
root@ubuntu:~/go/src/github.com/hyperhq/runv# runv --version
runv version 1.0.0, commit: v1.0.0-28-g4dc0184
root@ubuntu:~# cat /etc/containerd/config.toml
root = "/var/lib/containerd"
state = "/run/containerd"
subreaper = true
oom_score = 0

[grpc]
  address = "/run/containerd/containerd.sock"
  uid = 0
  gid = 0

[debug]
  address = "/run/containerd/debug.sock"
  uid = 0
  gid = 0
  level = "info"

[metrics]
  address = ""

[cgroup]
  path = ""

[plugins.linux]
  shim = "containerd-shim"
  no_shim = false
  runtime = "runv"
  shim_debug = true

And here is the kernel and image, @Ace-Tang :

root@ubuntu:~/go/src/github.com/hyperhq/runv# ll /var/lib/hyper/
total 10840
drwxr-xr-x  2 root root    4096 Oct 11 10:45 ./
drwxr-xr-x 44 root root    4096 Oct 11 10:45 ../
-rw-r--r--  1 root root 6992415 Oct 11 10:45 hyper-initrd.img
-rw-r--r--  1 root root 4177872 Oct 11 10:45 kernel

While I still got the error:

root@ubuntu:~# ctr run --rm -t docker.io/library/busybox:latest foobar1 echo foobar1
ctr: OCI runtime create failed: unable to retrieve OCI runtime error (open /run/containerd/io.containerd.runtime.v1.linux/default/foobar1/log.json: no such file or directory): runv did not terminate sucessfully: Unsupported driver ""

NAME:
   runv create - create a container

USAGE:
   runv create [command options] <container-id>

Where "<container-id>" is your name for the instance of the container that you
are creating. The name you provide for the container instance must be unique on
your host.

DESCRIPTION:
   The create command creates an instance of a container for a bundle. The bundle
is a directory with a specification file named "config.json" and a root
filesystem.

The specification file includes an args parameter. The args parameter is used
to specify command(s) that get run when the container is started. To change the
command(s) that get executed on start, edit the args parameter of the spec. See
"runv spec --help" for more explanation.

OPTIONS:
   --bundle value, -b value  path to the root of the bundle directory, defaults to the current directory (default: "/run/containerd/io.containerd.runtime.v1.linux/default/foobar1")
   --console value           specify the pty slave path for use with the container
   --console-socket value    specify the unix socket for sending the pty master back
   --pid-file value          specify the file to write the process id to
   --no-pivot                [ignore on runv] do not use pivot root to jail process inside rootfs.  This should be used whenever the rootfs is on top of a ramdisk

ERROR: logging before flag.Parse: E1011 10:39:48.471035   21463 main.go:149] app.Run(os.Args) failed with err: &errors.errorString{s:"Unsupported driver \"\""}
Unsupported driver ""
: unknown
allencloud commented 6 years ago

Actually It works for me. To be honest, I forget to install qemu. Thank @Ace-Tang for the advice. While I am wondering if there is any possibility to optimize the log report. I think current way is not so readable.

allencloud commented 6 years ago

Closing this. Thanks a lot.