Created
September 22, 2023 16:08
-
-
Save babeuloula/71089f3ba4e8ef2c9a07d133afe07759 to your computer and use it in GitHub Desktop.
Install Docker on NAS Synology AARCH64
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -e | |
ARCH=aarch64 | |
DOCKER_VERSION="24.0.6" | |
DOCKER_DIR=/volume2/@docker | |
echo "Downloading docker $DOCKER_VERSION-$ARCH" | |
curl "https://download.docker.com/linux/static/stable/$ARCH/docker-$DOCKER_VERSION.tgz" | tar -xz -C /usr/local/bin --strip-components=1 | |
echo "Creating docker working directory $DOCKER_DIR" | |
mkdir -p "$DOCKER_DIR" | |
echo "Creating docker.json config file" | |
mkdir -p /usr/local/etc/docker | |
cat <<EOT > /usr/local/etc/docker/docker.json | |
{ | |
"storage-driver": "vfs", | |
"iptables": false, | |
"bridge": "none", | |
"data-root": "$DOCKER_DIR" | |
} | |
EOT | |
echo "Creating docker startup script" | |
cat <<'EOT' > /usr/local/etc/rc.d/docker.sh | |
#!/bin/sh | |
# Start docker daemon | |
NAME=dockerd | |
PIDFILE=/var/run/$NAME.pid | |
DAEMON_ARGS="--config-file=/usr/local/etc/docker/docker.json --pidfile=$PIDFILE" | |
case "$1" in | |
start) | |
echo "Starting docker daemon" | |
/usr/local/bin/dockerd $DAEMON_ARGS & | |
;; | |
stop) | |
echo "Stopping docker daemon" | |
kill $(cat $PIDFILE) | |
;; | |
*) | |
echo "Usage: "$1" {start|stop}" | |
exit 1 | |
esac | |
exit 0 | |
EOT | |
chmod 755 /usr/local/etc/rc.d/docker.sh | |
echo "Creating docker group" | |
synogroup --add docker root | |
echo "Installing docker compose" | |
DOCKER_CLI_PLUGINS="/usr/local/lib/docker/cli-plugins" | |
echo "Creating docker working directory $DOCKER_CLI_PLUGINS" | |
mkdir -p "$DOCKER_CLI_PLUGINS" | |
DOCKER_COMPOSE_VERSION="2.22.0" | |
echo "Downloading docker $DOCKER_COMPOSE_VERSION-$ARCH" | |
curl -SL https://github.com/docker/compose/releases/download/v$DOCKER_COMPOSE_VERSION/docker-compose-linux-$ARCH -o $DOCKER_CLI_PLUGINS/docker-compose | |
chmod +x $DOCKER_CLI_PLUGINS/docker-compose | |
docker compose version | |
echo "Starting docker" | |
/usr/local/etc/rc.d/docker.sh start | |
echo "Done. Please add your user to the docker group in the Synology GUI and reboot your NAS." |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment