https://qiita.com/hogehoge789/items/cfe004351273b94b59b2
https://github.com/kata-containers/documentation/blob/master/install/docker/ubuntu-docker-install.md
$ sudo -E apt-get -y install apt-transport-https ca-certificates software-properties-common $ curl -sL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add - $ arch=$(dpkg --print-architecture) $ sudo -E add-apt-repository "deb [arch=${arch}] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" $ sudo -E apt-get update $ sudo -E apt-get -y install docker-ce
root@ubuntu:~# dpkg -l | grep docker ii docker-ce 5:19.03.13~3-0~ubuntu-bionic arm64 Docker: the open-source application container engine ii docker-ce-cli
Quick Start - Docker
Get the static binaries
The static binaries are posted on our release page, and 1.5.0 can be obtained as follows:
wget https://github.com/kata-containers/runtime/releases/download/1.5.0/kata-static-1.5.0-x86_64.tar.xz
The tarball is designed to be decompressed into /
, placing all of the files within /opt/kata/. The runtime configuration is expected to land at /opt/kata/share/defaults/kata-containers/configuration.toml. Your mileage will vary if you make further changes. To install Kata on your system:
sudo tar -xvf kata-static-1.5.0-x86_64.tar.xz -C /
-
Install the latest version of Docker with the following commands:
Notes:
- This step is only required if Docker is not installed on the system.
- Docker version 18.09 removed devicemapper support. If you wish to use a block based backend, see the options listed on https://github.com/kata-containers/documentation/issues/407.
$ sudo -E apt-get -y install apt-transport-https ca-certificates software-properties-common $ curl -sL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add - $ arch=$(dpkg --print-architecture) $ sudo -E add-apt-repository "deb [arch=${arch}] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" $ sudo -E apt-get update $ sudo -E apt-get -y install docker-ce
For more information on installing Docker please refer to the Docker Guide.
-
Configure Docker to use Kata Containers by default with ONE of the following methods:
-
systemd (this is the default and is applied automatically if you select the automatic installation option)
$ sudo mkdir -p /etc/systemd/system/docker.service.d/ $ cat <<EOF | sudo tee /etc/systemd/system/docker.service.d/kata-containers.conf [Service] ExecStart= ExecStart=/usr/bin/dockerd -D --add-runtime kata-runtime=/usr/bin/kata-runtime --default-runtime=kata-runtime EOF
-
Docker
daemon.json
Create docker configuration folder.
$ sudo mkdir -p /etc/docker
Add the following definitions to
/etc/docker/daemon.json
:{ "default-runtime": "kata-runtime", "runtimes": { "kata-runtime": { "path": "/usr/bin/kata-runtime" } } }
-
-
Restart the Docker systemd service with the following commands:
$ sudo systemctl daemon-reload $ sudo systemctl restart docker
root@ubuntu:~# systemctl restart docker Job for docker.service failed because the control process exited with error code. See "systemctl status docker.service" and "journalctl -xe" for details. root@ubuntu:~# systemctl status docker.service ● docker.service - Docker Application Container Engine Loaded: loaded (/lib/systemd/system/docker.service; enabled; vendor preset: enabled) Drop-In: /etc/systemd/system/docker.service.d └─kata-containers.conf Active: failed (Result: exit-code) since Tue 2020-09-29 14:38:26 HKT; 16s ago Docs: https://docs.docker.com Process: 19324 ExecStart=/usr/bin/dockerd -D --add-runtime kata-runtime=/usr/bin/kata-runtime --default-runtime= Main PID: 19324 (code=exited, status=1/FAILURE) Sep 29 14:38:26 ubuntu systemd[1]: docker.service: Service hold-off time over, scheduling restart. Sep 29 14:38:26 ubuntu systemd[1]: docker.service: Scheduled restart job, restart counter is at 3. Sep 29 14:38:26 ubuntu systemd[1]: Stopped Docker Application Container Engine. Sep 29 14:38:26 ubuntu systemd[1]: docker.service: Start request repeated too quickly. Sep 29 14:38:26 ubuntu systemd[1]: docker.service: Failed with result 'exit-code'. Sep 29 14:38:26 ubuntu systemd[1]: Failed to start Docker Application Container Engine. lines 1-15/15 (END)
root@ubuntu:~# /usr/bin/dockerd -D --add-runtime kata-runtime=/usr/bin/kata-runtime --default-runtime=kata-runtime unable to configure the Docker daemon with file /etc/docker/daemon.json: the following directives are specified both as a flag and in the configuration file: default-runtime: (from flag: kata-runtime, from file: kata-runtime) root@ubuntu:~#
安装kata
root@ubuntu:/opt/gopath/src/github.com# kata-runtime kata-check System is capable of running Kata Containers System can currently create Kata Containers root@ubuntu:/opt/gopath/src/github.com#
删掉
daemon.json.bak
mv /etc/docker/daemon.json /etc/docker/daemon.json.bak
保留
systemctl daemon-reload
docker.service.d
vi /etc/systemd/system/docker.service.d
-
Run Kata Containers
You are now ready to run Kata Containers:
$ sudo docker run busybox uname -a
The previous command shows details of the kernel version running inside the container, which is different to the host kernel version.
docker run --rm -it --runtime kata-runtime busybox uname -r docker: Error response from daemon: OCI runtime create failed: Failed to check if grpc server is working: rpc error: code = Unavailable desc = transport is closing: unknown.
root@ubuntu:/home/ubuntu# docker run --rm -it --runtime kata-runtime busybox uname -r docker: Error response from daemon: OCI runtime create failed: Failed to check if grpc server is working: rpc error: code = Unavailable desc = transport is closing: unknown. root@ubuntu:/home/ubuntu# kata-collect-data.sh > /tmp/kata-collect-data.log root@ubuntu:/home/ubuntu#
root@ubuntu:~# kata-runtime kata-env | grep debug root@ubuntu:~# kata-runtime kata-env | grep -i debug Debug = false Debug = false Debug = false Debug = false Debug = false Debug = false root@ubuntu:~#
root@ubuntu:/opt/gopath/src/github.com/kata-containers/osbuilder/rootfs-builder# ls /usr/share/kata-containers/kata-containers-initrd.img /usr/share/kata-containers/kata-containers-initrd.img root@ubuntu:/opt/gopath/src/github.com/kata-containers/osbuilder/rootfs-builder# ls /usr/share/kata-containers/kata-containers.img /usr/share/kata-containers/kata-containers.img root@ubuntu:/opt/gopath/src/github.com/kata-containers/osbuilder/rootfs-builder# docker run --rm -it --runtime kata-runtime busybox uname -r docker: Error response from daemon: OCI runtime create failed: /usr/share/defaults/kata-containers/configuration-qemu.toml: file /usr/share/kata-containers/vmlinuz.container does not exist: unknown. root@ubuntu:/opt/gopath/src/github.com/kata-containers/osbuilder/rootfs-builder# vi /usr/share/defaults/kata-containers/configuration.toml
mv kata-containers.img vmlinuz.container
root@ubuntu:/opt/gopath/src/github.com/kata-containers/osbuilder/rootfs-builder# docker run --rm -it --runtime kata-runtime busybox uname -r docker: Error response from daemon: OCI runtime create failed: failed to launch qemu: exit status 1, error messages from qemu log: rom: requested regions overlap (rom /usr/share/kata-containers/kata-containers-initrd.img. free=0x000000004b080000, addr=0x0000000048000000) qemu-system-aarch64: rom check and register reset failed: unknown.
kata romfile=: 'pcie-pci-bridge' is not a valid device model name
https://github.com/kata-containers/kata-containers/issues/28
https://my.oschina.net/u/4284509/blog/3933348
具体安装步骤为:
1.进入qemu源码目录
执行./configure --enable-virtfs,这里是为了开启虚拟文件系统,如果不添加这个参数.在运行docker启动kata-container时,会报'virtio-9p-pci' is not a valid device model name: unknown的错误
2.执行make&&sudo make install
3.将/usr/local/bin/qemu-system-x86_64拷贝为/usr/bin/qemu-lite-system-x86_64
Kata-container 环境搭建手顺
apt-get -y install libcap-ng-dev
root@ubuntu:/opt/gopath/src/github.com/kata-containers/osbuilder/initrd-builder# docker run --rm -it --runtime kata-runtime busybox uname -r docker: Error response from daemon: OCI runtime create failed: failed to launch qemu: exit status 1, error messages from qemu log: qemu-system-aarch64: Property '.pmu' not found: unknown.
docker run --rm -it --runtime kata-runtime busybox uname -r docker: Error response from daemon: OCI runtime create failed: failed to launch qemu: exit status 1, error messages from qemu log: qemu-system-aarch64: -device pcie-pci-bridge,bus=pcie.0,id=pcie-bridge-0,addr=2,romfile=: 'pcie-pci-bridge' is not a valid device model name: unknown.
root@ubuntu:~/kata/qemu/build# kata-runtime --version kata-runtime : 1.12.0-alpha1 commit : 011c73f24a94118c74a1833fb2f27da0eaf3b576 OCI specs: 1.0.1-dev root@ubuntu:~/kata/qemu/build#
kata配置
root@ubuntu:~# kata-runtime --kata-show-default-config-paths
/etc/kata-containers/configuration.toml
/usr/share/defaults/kata-containers/configuration.toml
root@ubuntu:~# cat /etc/kata-containers/configuration.toml