Synology DS218: unsupported Docker installation and usage...

behainguyen

Be Hai Nguyen

Posted on July 20, 2022

Synology DS218: unsupported Docker installation and usage...

Disclaimer

  • I take no responsibilities for any damages or losses resulting from applying the procedures outlined in this post.
  • Damages and losses include both hardware, software and data.

Table of contents

Environments

  1. DSM 7.1-42661 Update 3.
  2. Windows 10 Pro -- version 10.0.19044 build 19044.
  3. Windows “docker” CLI -- version 20.10.12, build e91ed57.
  4. Windows Docker Desktop -- version 4.4.3. The latest version is 4.10.1.
  5. Synology DS218 -- it's accessed via its device name omphalos-nas-01 instead of its IP address.

AArch64 and ARM64

The two terms refer to the same CPU architecture. Please see:

  1. The Future Is Now; ARM’s AARCH64 on the Rise – with Instana
  2. Wikipedia -- AArch64
  3. Wikipedia -- ARM architecture family

SSH into Synology NAS box and run the following two ( 2 ) commands to get the processor and architecture:



$ cat /proc/cpuinfo | grep "model name" | uniq
$ uname -m


Enter fullscreen mode Exit fullscreen mode

My unit gives the following two ( 2 ) outputs respectively:



model name      : ARMv8 Processor rev 4 (v8l)
aarch64


Enter fullscreen mode Exit fullscreen mode

References

There're plenty of posts which assert that Docker does support AArch64, and it should be possible to install Docker on Synology models which use AArch64.

  1. Installing Docker on a Synology ARM NAS -- not my principal reference, I did not act on its instructions, but it does have some valuable information.
  2. Can I install Docker on arm8 based Synology Nas -- this is the principal post, I follow the instructions given by user Hikariii to carry out the installation.
  3. Multi-arch container images for Docker and Kubernetes -- I use instructions in section “Modern multi-arch docker image build process with BuildKit (buildx)” to build a Docker image for linux/arm64 platform, and use this image to test the installation.

Installation steps

SSH into Synology DS218 to use command line.

Download binary. From https://download.docker.com/linux/static/stable/aarch64, manually download the latest Docker binary, which is docker-20.10.9.tgz to DS218 $HOME directory.

Extract content. Run the following commands:



$ cd $HOME
$ tar xzvf docker-20.10.9.tgz


Enter fullscreen mode Exit fullscreen mode

Copy extracted content to /usr/bin/:



$ sudo cp docker/* /usr/bin/


Enter fullscreen mode Exit fullscreen mode

( I'm just being pedantic! ) Verify copy. Based on the content of extracted directory, $HOME/docker/, verify files've been copied to /usr/bin/ with:



$ ls -l /usr/bin/containerd
$ ls -l /usr/bin/containerd-shim
$ ls -l /usr/bin/containerd-shim-runc-v2
$ ls -l /usr/bin/ctr
$ ls -l /usr/bin/docker
$ ls -l /usr/bin/dockerd
$ ls -l /usr/bin/docker-init
$ ls -l /usr/bin/docker-proxy
$ ls -l /usr/bin/runc


Enter fullscreen mode Exit fullscreen mode

Create the file /etc/docker/daemon.json. We'll need to do this via sudo.



File /etc/docker/daemon.json


Enter fullscreen mode Exit fullscreen mode


{
  "storage-driver": "vfs",
  "iptables": false,
  "bridge": "none"
}


Enter fullscreen mode Exit fullscreen mode

Run the Docker daemon:



$ sudo dockerd &


Enter fullscreen mode Exit fullscreen mode

The output is very long, around 81 ( eighty one ) lines... There're a lot warnings, but the daemon does run.

Run the Portainer administrative UI. Based on https://raw.githubusercontent.com/wdmomoxx/catdriver/master/install-docker.sh, run:



$ sudo docker run -d --network=host -v "/run/docker.sock:/var/run/docker.sock" portainer/portainer:linux-arm64


Enter fullscreen mode Exit fullscreen mode

This Portainer is listening on port 9000. On Windows 10, run a web browser with:



http://omphalos-nas-01:9000


Enter fullscreen mode Exit fullscreen mode

We'll get the following screen:

029-01-portainer.png

Create the admin user as required. We'll get logged in:

029-02-portainer.png

Select the Local tab, then click on the Connect button on the bottom left hand corner: this Portainer UI is now connected to Docker on my Synology DS218 box. This Portainer UI looks very similar to the Docker Desktop on Windows 10.

A test build. I didn't expect it to work. Recall, user Hikariii mentions in Can I install Docker on arm8 based Synology Nas:

you can easily run out of space for docker since the default dsm / mount is only 2GB, to prevent this you can create a docker folder on your volume, mount it to /docker and set it as data-root:
...

Build a simple Python image:



behai@omphalos-nas-01:/var/services/web/app_demo$ sudo docker build --tag app-demo .


Enter fullscreen mode Exit fullscreen mode


Password:
Sending build context to Docker daemon  19.97kB
Step 1/6 : FROM python:3.8-slim-buster
3.8-slim-buster: Pulling from library/python
...
Status: Downloaded newer image for python:3.8-slim-buster
 ---> 9f30b95a0f37
Step 2/6 : WORKDIR /app_demo
no space left on device
behai@omphalos-nas-01:/var/services/web/app_demo$


Enter fullscreen mode Exit fullscreen mode

This last error was no space left on device.

Mount more disk space.

⓵ Use “File Station” to create docker/ directory, and give it 10 GB.

⓶ This directory is /volume1/docker

⓷ Mount Docker volume:



$ cd $HOME
$ sudo mkdir -p /volume1/@Docker/lib
$ sudo mount -o bind "/volume1/@Docker/lib" /volume1/docker


Enter fullscreen mode Exit fullscreen mode

⓸ Modified /etc/docker/daemon.json -- add { "data-root": "/volume1/docker" }:



File /etc/docker/daemon.json


Enter fullscreen mode Exit fullscreen mode


{
  "storage-driver": "vfs",
  "iptables": false,
  "bridge": "none",
  "data-root": "/volume1/docker"
}


Enter fullscreen mode Exit fullscreen mode

Please note, at this point, Portainer administrative UI showed around five to six ( 5 to 6 ) entries for Volumes, one ( 1 ) was used by the Portainer container itself. Except for the Portainer volume, I manually removed all those others.

⓹ Restart the DS218 box.

Then run the Docker daemon and Portainer UI with:



$ sudo dockerd &
$ sudo docker run -d --network=host -v "/run/docker.sock:/var/run/docker.sock" portainer/portainer:linux-arm64


Enter fullscreen mode Exit fullscreen mode

It seemed to download the Portainer image again. Portainer's Volumes now shows:

029-03-portainer.png

Re-run the same build again, the error no space left on device has gone away. But there're still a lot of other errors which I can't solve yet:

029-04-docker-build-app-demo.png

Test installation

I've attempted several fixes to get the build going on the Synology DS218 box, I can't yet find a solution. I'm sleeping on it for the time being. Docker CLI and Docker Desktop are fully functional on my Windows 10, so I thought I would build images on Windows 10, push them onto Docker hub repositories, and then run these images on Synology DS218. The followings are what I've tried.

For this test build, I'm using the Build your Python image tutorial -- the Python project is simpler than the app_demo project I use in the previous section. Note, since the project is simple, I didn't do Flask install, but constructed requirements.txt manually. The project layout looks like this:



f:\python_docker
|
|-- app.py
|-- Dockerfile
|-- requirements.txt


Enter fullscreen mode Exit fullscreen mode


File f:\python_docker\app.py


Enter fullscreen mode Exit fullscreen mode


from flask import Flask
app = Flask(__name__)

@app.route('/')
def hello_world():
    return 'Hello, Docker!'


Enter fullscreen mode Exit fullscreen mode


File f:\python_docker\Dockerfile


Enter fullscreen mode Exit fullscreen mode


# syntax=docker/dockerfile:1

FROM python:3.8-slim-buster

WORKDIR /app

COPY requirements.txt requirements.txt
RUN pip3 install -r requirements.txt

COPY . .

CMD [ "python3", "-m" , "flask", "run", "--host=0.0.0.0", "--port=9880"]


Enter fullscreen mode Exit fullscreen mode


File f:\python_docker\requirements.txt


Enter fullscreen mode Exit fullscreen mode


Flask==2.1.3


Enter fullscreen mode Exit fullscreen mode

I don't want to repeat my failed attempts. In short, I just tried whatever that popped into my head that seemed logical: none worked. Based on the errors, I did some searches, and eventually found this post Multi-arch container images for Docker and Kubernetes -- The relevant section is “Modern multi-arch docker image build process with BuildKit (buildx)”:

Create a multi-arch build profile. On Windows 10, run:



F:\python_docker>docker buildx create --name mybuilder --driver-opt network=host --use


Enter fullscreen mode Exit fullscreen mode

Then inspect it:



F:\python_docker>docker buildx inspect --bootstrap


Enter fullscreen mode Exit fullscreen mode

My output:



[+] Building 90.9s (1/1) FINISHED
 => [internal] booting buildkit                                                                                                                                                                            90.0s
 => => pulling image moby/buildkit:buildx-stable-1                                                                                                                                                         86.3s
 => => creating container buildx_buildkit_mybuilder0                                                                                                                                                        3.7s
Name:   mybuilder
Driver: docker-container

Nodes:
Name:      mybuilder0
Endpoint:  npipe:////./pipe/docker_engine
Status:    running
Platforms: linux/amd64, linux/amd64/v2, linux/amd64/v3, linux/arm64, linux/riscv64, linux/ppc64le, linux/s390x, linux/386, linux/mips64le, linux/mips64, linux/arm/v7, linux/arm/v6

F:\python_docker>


Enter fullscreen mode Exit fullscreen mode

Clean up https://hub.docker.com/repositories. Delete behai/python-docker image from https://hub.docker.com/repositories -- if exists.

Build image behai/python-docker for linux/arm64 platform and push it to https://hub.docker.com/repositories.

⓵ On Windows 10 command prompt, log into https://hub.docker.com with:



F:\python_docker>docker login


Enter fullscreen mode Exit fullscreen mode

⓶ Now run the build and push:



F:\python_docker>docker buildx build --platform linux/arm64 --tag behai/python-docker --push .


Enter fullscreen mode Exit fullscreen mode

My successful output looks like the screen capture below:

029-05-docker-buildx-build.png

The image behai/python-docker should now be pushed onto https://hub.docker.com/repositories -- we should verify that it's there.

Test the image on Synology DS218.

⓵ On Synology DS218 command line, run:



$ sudo docker run -d --network=host -v "/run/docker.sock:/var/run/docker.sock" --rm behai/python-docker


Enter fullscreen mode Exit fullscreen mode

It should run successfully, the output is as screen capture below:

029-06-docker-run-linux-arm64-01-a.png

⓶ On Windows 10, run a web browser with:



http://omphalos-nas-01:9880


Enter fullscreen mode Exit fullscreen mode

It should run with no problem:

029-06-docker-run-linux-arm64-01-b.png

⓷ When finished testing, looks for Container ID with:



$ sudo docker ps -a


Enter fullscreen mode Exit fullscreen mode

And then stop the target container with:



$ sudo docker container stop <Container ID>


Enter fullscreen mode Exit fullscreen mode

We don't need to remove the container, since the --rm flag'll cause the container to be removed when stopped.

⓸ My second test is with app-demo discussed previously. I'll not be listing the build process presently. On the Synology DS218 box, run it as:



$ sudo docker run -d --network=host -v "/run/docker.sock:/var/run/docker.sock" --rm behai/app-demo:arm64flask


Enter fullscreen mode Exit fullscreen mode

On Windows 10, run a web browser also with:



http://omphalos-nas-01:9880


Enter fullscreen mode Exit fullscreen mode

The browser should just display:



Hello, World!


Enter fullscreen mode Exit fullscreen mode

Other commands from Multi-arch container images for Docker and Kubernetes. Run on Windows 10.

⓵ Inspect image command.



F:\python_docker>docker buildx imagetools inspect behai/python-docker


Enter fullscreen mode Exit fullscreen mode

I did run this command, it works as described.

⓶ Remove the multi-arch build profile created previously:



( F:\python_docker> )docker buildx rm mybuilder


Enter fullscreen mode Exit fullscreen mode

I didn't run the above command. Its offical documentation is at docker buildx rm.

On Windows Docker Desktop, the first screen on start up shows:



buildx_buildkit_mybuilder0 ... RUNNING


Enter fullscreen mode Exit fullscreen mode

Pending issues

❶ I can't do builds as mentioned previously.

❷ While Docker daemon is running, the following warnings pop up on the SSH screen:



WARN[2022-07-15T14:17:35.016826267+10:00] Could not get operating system name: Error opening /usr/lib/os-release: open /usr/lib/os-release: no such file or directory
WARN[2022-07-15T14:17:35.017024230+10:00] Could not get operating system version: Error opening /usr/lib/os-release: open /usr/lib/os-release: no such file or directory


Enter fullscreen mode Exit fullscreen mode


WARN[2022-07-19T14:25:48.160521974+10:00] seccomp is not enabled in your kernel, running container without default profile
time="2022-07-19T14:25:48.574068043+10:00" level=info msg="starting signal loop" namespace=moby path=/run/docker/containerd/daemon/io.containerd.runtime.v2.task/moby/e9997b732228c64610cdcc9fef2f785225539b47076bcac9b4470f9bac8a7d56 pid=16006


Enter fullscreen mode Exit fullscreen mode

❸ I'm not using Docker everyday, so at the moment, I'm happy to start Docker daemon manually everytime I need to use it.

❹ I haven't set up Docker Group as per instructions either. I'm happy to run docker CLI under sudo.

Concluding remarks

On my Synology DS218, Docker is still not fully functional yet. For the time being, I can use Windows 10 to build images for AArch64 platform, and test these images on the DS218 box -- so at least I can use it as a test box.

I would like to get rid of the build errors and warnings etc... I'll attempt to work on these -- this will be an ongoing task for me.

It has been an interesting learning exercise... I'm happy with the results. I hope you find this post useful, and you can use the information for your own attempt. Thank you for reading and happy Dockering 😂😂😂

💖 💪 🙅 🚩
behainguyen
Be Hai Nguyen

Posted on July 20, 2022

Join Our Newsletter. No Spam, Only the good stuff.

Sign up to receive the latest update from our blog.

Related