|
| 1 | +# Install Docker for Kata Containers on SLES |
| 2 | + |
| 3 | +> **Note:** |
| 4 | +> |
| 5 | +> - This guide assumes you have |
| 6 | +> [already installed the Kata Containers packages](../sles-installation-guide.md). |
| 7 | +> |
| 8 | +> - If you do not want to copy or type all these instructions by hand, you can use the |
| 9 | +> [`kata-manager`](https://github.com/kata-containers/tests/blob/master/cmd/kata-manager/kata-manager.sh) |
| 10 | +> script to install the packaged system including your chosen container |
| 11 | +> manager. Alternatively, you can generate a runnable shell script from |
| 12 | +> individual documents using the |
| 13 | +> [`kata-doc-to-script`](https://github.com/kata-containers/tests/blob/master/.ci/kata-doc-to-script.sh) script. |
| 14 | +
|
| 15 | +1. Install the latest version of Docker with the following commands: |
| 16 | + |
| 17 | + > **Note:** This step is only required if Docker is not installed on the system. |
| 18 | +
|
| 19 | + ```bash |
| 20 | + $ sudo zypper -n install docker |
| 21 | + ``` |
| 22 | + |
| 23 | + For more information on installing Docker please refer to the |
| 24 | + [Docker Guide](https://www.suse.com/documentation/sles-12/singlehtml/book_sles_docker/book_sles_docker.html). |
| 25 | + |
| 26 | +2. Configure Docker to use Kata Containers with one of the following methods: |
| 27 | + |
| 28 | + 1. systemd |
| 29 | + |
| 30 | + ```bash |
| 31 | + $ sudo mkdir -p /etc/systemd/system/docker.service.d/ |
| 32 | + $ cat <<EOF | sudo tee /etc/systemd/system/docker.service.d/kata-containers.conf |
| 33 | + [Service] |
| 34 | + ExecStart= |
| 35 | + ExecStart=/usr/bin/dockerd -D --containerd /run/containerd/containerd.sock --add-runtime kata-runtime=/usr/bin/kata-runtime --default-runtime=kata-runtime |
| 36 | + EOF |
| 37 | + ``` |
| 38 | +
|
| 39 | + 2. Docker `daemon.json` |
| 40 | +
|
| 41 | + Add the following definitions to `/etc/docker/daemon.json`: |
| 42 | +
|
| 43 | + ```json |
| 44 | + { |
| 45 | + "default-runtime": "kata-runtime", |
| 46 | + "runtimes": { |
| 47 | + "kata-runtime": { |
| 48 | + "path": "/usr/bin/kata-runtime" |
| 49 | + } |
| 50 | + } |
| 51 | + } |
| 52 | + ``` |
| 53 | +
|
| 54 | +3. Restart the Docker systemd service with the following commands: |
| 55 | +
|
| 56 | + ```bash |
| 57 | + $ sudo systemctl daemon-reload |
| 58 | + $ sudo systemctl restart docker |
| 59 | + ``` |
| 60 | +
|
| 61 | +4. Run Kata Containers |
| 62 | +
|
| 63 | + You are now ready to run Kata Containers: |
| 64 | +
|
| 65 | + ```bash |
| 66 | + $ sudo docker run busybox uname -a |
| 67 | + ``` |
| 68 | +
|
| 69 | + The previous command shows details of the kernel version running inside the |
| 70 | + container, which is different to the host kernel version. |
0 commit comments