mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-08-12 21:27:02 +00:00
dev-guide: detect & use existing docker unit file
Only create a new docker unit file if no other existing unit files are detected. Creating a new docker file when not necessary may mask out existing docker daemon configurations. Fixes: #300 Signed-off-by: Marco Vedovati <mvedovati@suse.com>
This commit is contained in:
parent
4cd5f2cbb8
commit
59ce0b3d4e
@ -259,7 +259,7 @@ $ script -fec 'sudo -E USE_DOCKER=true ./image_builder.sh ${ROOTFS_DIR}'
|
|||||||
```
|
```
|
||||||
|
|
||||||
> **Notes:**
|
> **Notes:**
|
||||||
>
|
>
|
||||||
> - You must ensure that the *default Docker runtime* is `runc` to make use of
|
> - You must ensure that the *default Docker runtime* is `runc` to make use of
|
||||||
> the `USE_DOCKER` variable. If that is not the case, remove the variable
|
> the `USE_DOCKER` variable. If that is not the case, remove the variable
|
||||||
> from the previous command. See [Checking Docker default runtime](#checking-docker-default-runtime).
|
> from the previous command. See [Checking Docker default runtime](#checking-docker-default-runtime).
|
||||||
@ -356,14 +356,13 @@ $ rm -rf "${tmpdir}"
|
|||||||
|
|
||||||
# Run Kata Containers with Docker
|
# Run Kata Containers with Docker
|
||||||
|
|
||||||
## Update Docker configuration
|
## Update the Docker systemd unit file
|
||||||
|
|
||||||
```
|
```
|
||||||
$ dir=/etc/systemd/system/docker.service.d
|
$ dockerUnit=$(systemctl show -p FragmentPath docker.service | cut -d "=" -f 2)
|
||||||
$ file="$dir/kata-containers.conf"
|
$ unitFile=${dockerUnit:-/etc/systemd/system/docker.service.d/kata-containers.conf}
|
||||||
$ sudo mkdir -p "$dir"
|
$ test -e "$unitFile" || { sudo mkdir -p "$(dirname $unitFile)"; echo -e "[Service]\nType=simple\nExecStart=\nExecStart=/usr/bin/dockerd -D --default-runtime runc" | sudo tee "$unitFile"; }
|
||||||
$ sudo test -e "$file" || echo -e "[Service]\nType=simple\nExecStart=\nExecStart=/usr/bin/dockerd -D --default-runtime runc" | sudo tee "$file"
|
$ grep -q "kata-runtime=" $unitFile || sudo sed -i 's!^\(ExecStart=[^$].*$\)!\1 --add-runtime kata-runtime=/usr/local/bin/kata-runtime!g' "$unitFile"
|
||||||
$ sudo grep -q "kata-runtime=" $file || sudo sed -i 's!^\(ExecStart=[^$].*$\)!\1 --add-runtime kata-runtime=/usr/local/bin/kata-runtime!g' "$file"
|
|
||||||
$ sudo systemctl daemon-reload
|
$ sudo systemctl daemon-reload
|
||||||
$ sudo systemctl restart docker
|
$ sudo systemctl restart docker
|
||||||
```
|
```
|
||||||
@ -479,7 +478,7 @@ implementation you chose, and the kubelet service has to be updated accordingly.
|
|||||||
|
|
||||||
`/etc/systemd/system/kubelet.service.d/0-crio.conf`
|
`/etc/systemd/system/kubelet.service.d/0-crio.conf`
|
||||||
```
|
```
|
||||||
[Service]
|
[Service]
|
||||||
Environment="KUBELET_EXTRA_ARGS=--container-runtime=remote --runtime-request-timeout=15m --container-runtime-endpoint=unix:///var/run/crio/crio.sock"
|
Environment="KUBELET_EXTRA_ARGS=--container-runtime=remote --runtime-request-timeout=15m --container-runtime-endpoint=unix:///var/run/crio/crio.sock"
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -487,7 +486,7 @@ Environment="KUBELET_EXTRA_ARGS=--container-runtime=remote --runtime-request-tim
|
|||||||
|
|
||||||
`/etc/systemd/system/kubelet.service.d/0-cri-containerd.conf`
|
`/etc/systemd/system/kubelet.service.d/0-cri-containerd.conf`
|
||||||
```
|
```
|
||||||
[Service]
|
[Service]
|
||||||
Environment="KUBELET_EXTRA_ARGS=--container-runtime=remote --runtime-request-timeout=15m --container-runtime-endpoint=unix:///run/containerd/containerd.sock"
|
Environment="KUBELET_EXTRA_ARGS=--container-runtime=remote --runtime-request-timeout=15m --container-runtime-endpoint=unix:///run/containerd/containerd.sock"
|
||||||
```
|
```
|
||||||
For more information about CRI-containerd see the "Configure Kubelet to use containerd"
|
For more information about CRI-containerd see the "Configure Kubelet to use containerd"
|
||||||
|
Loading…
Reference in New Issue
Block a user