install: improve Docker installation for openSUSE

Editing systemd unit files to customize Docker for Kata may generate conflicts
with what's specified in /etc/sysconfig/docker, so use that file directly.

Also, libcgroup1 dependency is wrong for newer distros, and should be
pulled automatically for older ones.

Signed-off-by: Marco Vedovati <mvedovati@suse.com>
This commit is contained in:
Marco Vedovati 2019-05-23 12:54:31 +02:00
parent b2c002415c
commit 72b296d319
4 changed files with 24 additions and 15 deletions

View File

@ -1,4 +1,4 @@
# Install Docker for Kata Containers on openSUSE Leap/Tumbleweed # Install Docker for Kata Containers on openSUSE
> **Note:** > **Note:**
> >
@ -14,24 +14,24 @@
> If you wish to use a block based backend, see the options listed on https://github.com/kata-containers/documentation/issues/407. > If you wish to use a block based backend, see the options listed on https://github.com/kata-containers/documentation/issues/407.
```bash ```bash
$ sudo zypper -n install libcgroup1
$ sudo zypper -n install docker $ sudo zypper -n install docker
``` ```
For more information on installing Docker please refer to the For more information on installing Docker please refer to the
[Docker Guide](https://software.opensuse.org/package/docker). [Docker Guide](https://software.opensuse.org/package/docker).
2. Configure Docker to use Kata Containers by default with one of the following methods: 2. Configure the Docker daemon to use Kata Containers by default, with one of the following methods:
1. systemd 1. Specify the runtime options in `/etc/sysconfig/docker`:
```bash ```bash
$ sudo mkdir -p /etc/systemd/system/docker.service.d/ $ DOCKER_SYSCONFIG=/etc/sysconfig/docker
$ cat <<EOF | sudo tee /etc/systemd/system/docker.service.d/kata-containers.conf # Add kata-runtime to the list of available runtimes, if not already listed
[Service] $ grep -qE "^ *DOCKER_OPTS=.+--add-runtime[= ] *kata-runtime" $DOCKER_SYSCONFIG || sudo -E sed -i -E "s|^( *DOCKER_OPTS=.+)\" *$|\1 --add-runtime kata-runtime=/usr/bin/kata-runtime\"|g" $DOCKER_SYSCONFIG
ExecStart= # If a current default runtime is specified, overwrite it with kata-runtime
ExecStart=/usr/bin/dockerd -D --add-runtime kata-runtime=/usr/bin/kata-runtime --default-runtime=kata-runtime $ sudo -E sed -i -E "s|^( *DOCKER_OPTS=.+--default-runtime[= ] *)[^ \"]+(.*\"$)|\1kata-runtime\2|g" $DOCKER_SYSCONFIG
EOF # Add kata-runtime as default runtime, if no default runtime is specified
$ grep -qE "^ *DOCKER_OPTS=.+--default-runtime" $DOCKER_SYSCONFIG || sudo -E sed -i -E "s|^( *DOCKER_OPTS=.+)(\"$)|\1 --default-runtime=kata-runtime\2|g" $DOCKER_SYSCONFIG
``` ```
2. Docker `daemon.json` 2. Docker `daemon.json`

View File

@ -1,4 +1,4 @@
# Install Kata Containers on openSUSE Leap/Tumbleweed # Install Kata Containers on openSUSE
1. Install the Kata Containers components with the following commands: 1. Install the Kata Containers components with the following commands:
@ -18,6 +18,5 @@
``` ```
2. Decide which container manager to use and select the corresponding link that follows: 2. Decide which container manager to use and select the corresponding link that follows:
- [Docker](docker/opensuse-docker-install.md) - [Docker](docker/opensuse-docker-install.md)
- [Kubernetes](https://github.com/kata-containers/documentation/blob/master/Developer-Guide.md#run-kata-containers-with-kubernetes) - [Kubernetes](../Developer-Guide.md#run-kata-containers-with-kubernetes)

View File

@ -1,6 +1,7 @@
# Install Kata Containers on openSUSE Leap # Install Kata Containers on openSUSE Leap
Follow the instructions in the generic [openSUSE install guide](opensuse-installation-guide.md). 1. Install Kata Containers on openSUSE by following the instructions in the
[openSUSE install guide](opensuse-installation-guide.md).
<!-- <!--
You can ignore the content of this comment. You can ignore the content of this comment.
(test code run by test-install-docs.sh to validate code blocks this document) (test code run by test-install-docs.sh to validate code blocks this document)
@ -12,3 +13,7 @@ https://raw.githubusercontent.com/kata-containers/documentation/master/install/o
Please download this file and run kata-doc-to-script.sh again." Please download this file and run kata-doc-to-script.sh again."
``` ```
--> -->
2. Decide which container manager to use and select the corresponding link that follows:
- [Docker](docker/opensuse-leap-docker-install.md)
- [Kubernetes](../Developer-Guide.md#run-kata-containers-with-kubernetes)

View File

@ -1,6 +1,7 @@
# Install Kata Containers on openSUSE Tumbleweed # Install Kata Containers on openSUSE Tumbleweed
Follow the instructions in the generic [openSUSE install guide](opensuse-installation-guide.md). 1. Install Kata Containers on openSUSE by following the instructions in the
[openSUSE install guide](opensuse-installation-guide.md).
<!-- <!--
You can ignore the content of this comment. You can ignore the content of this comment.
(test code run by test-install-docs.sh to validate code blocks this document) (test code run by test-install-docs.sh to validate code blocks this document)
@ -12,3 +13,7 @@ https://raw.githubusercontent.com/kata-containers/documentation/master/install/o
Please download this file and run kata-doc-to-script.sh again." Please download this file and run kata-doc-to-script.sh again."
``` ```
--> -->
2. Decide which container manager to use and select the corresponding link that follows:
- [Docker](docker/opensuse-tumbleweed-docker-install.md)
- [Kubernetes](../Developer-Guide.md#run-kata-containers-with-kubernetes)