Delete kata container after install

This commit is contained in:
Peter Šurda 2021-02-12 08:33:42 +01:00
parent 87b91e3203
commit 0150d3abf2
Signed by untrusted user: PeterSurda
GPG Key ID: 0C5F50C0B5F37D87
1 changed files with 5 additions and 0 deletions

View File

@ -30,10 +30,15 @@ mempercore=$(((mem/1024-4096)/cores))
if ! docker info 2>/dev/null|grep Runtimes:|grep -qs kata-qemu-virtiofs; then
echo "Installing kata...."
cid=$(docker run -d --runtime=runc -v /opt/kata:/opt/kata -v /var/run/dbus:/var/run/dbus -v /run/systemd:/run/systemd -v /etc/docker:/etc/docker -it katadocker/kata-deploy kata-deploy-docker install)
# wait for finish
while [ "$(docker container inspect -f '{{.State.Running}}' "$cid")" == "true" ]; do
sleep 1
# delete container
docker rm $cid
# update default container CPU and memory
sed -i "s/default_vcpus = .*/default_vcpus = 2/g;s/default_memory = .*/default-memory = $mempercore/g" /opt/kata/share/defaults/kata-containers/configuration-qemu-virtiofs.toml
echo "Kata installed"