From 36b6fe1f3b6e0341c8514a65dc8d61faa9582117 Mon Sep 17 00:00:00 2001 From: Xavier Petit <32063953+xpetit@users.noreply.github.com> Date: Mon, 3 Feb 2020 17:25:24 +0000 Subject: [PATCH] Add docker relocation service --- scripts/install_client.sh | 3 +++ scripts/system/etc/systemd/system/mount-docker.service | 10 ++++++++++ scripts/system/usr/local/bin/mount-docker.sh | 10 ++++++++++ 3 files changed, 23 insertions(+) create mode 100644 scripts/system/etc/systemd/system/mount-docker.service create mode 100755 scripts/system/usr/local/bin/mount-docker.sh diff --git a/scripts/install_client.sh b/scripts/install_client.sh index d5567bf8a..1b6fd4572 100755 --- a/scripts/install_client.sh +++ b/scripts/install_client.sh @@ -116,6 +116,9 @@ if ! test -v PERSISTENT; then # Disable user password passwd -d student + # Enable docker relocation + systemctl enable mount-docker + # Remove tty cat <<-EOF>> /etc/systemd/logind.conf NAutoVTs=0 diff --git a/scripts/system/etc/systemd/system/mount-docker.service b/scripts/system/etc/systemd/system/mount-docker.service new file mode 100644 index 000000000..0ad039aff --- /dev/null +++ b/scripts/system/etc/systemd/system/mount-docker.service @@ -0,0 +1,10 @@ +[Unit] +Description=Docker relocation +Before=docker.service + +[Service] +ExecStart=/usr/local/bin/mount-docker.sh +Type=oneshot + +[Install] +RequiredBy=docker.service diff --git a/scripts/system/usr/local/bin/mount-docker.sh b/scripts/system/usr/local/bin/mount-docker.sh new file mode 100755 index 000000000..52fdeea78 --- /dev/null +++ b/scripts/system/usr/local/bin/mount-docker.sh @@ -0,0 +1,10 @@ +#!/usr/bin/env bash + +# Unofficial Bash Strict Mode +set -euo pipefail +IFS=' +' + +cp -a /var/lib/docker /tmp +mount -t tmpfs -osize=2G tmpfs /var/lib/docker +mv /tmp/docker/* /var/lib/docker