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
- AArch64 and ARM64
- References
- Installation steps
- Test installation
- Pending issues
- Concluding remarks
Environments
- DSM 7.1-42661 Update 3.
- Windows 10 Pro -- version 10.0.19044 build 19044.
- Windows “docker” CLI -- version 20.10.12, build e91ed57.
- Windows Docker Desktop -- version 4.4.3. The latest version is 4.10.1.
- 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:
- The Future Is Now; ARM’s AARCH64 on the Rise – with Instana
- Wikipedia -- AArch64
- 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
My unit gives the following two ( 2 ) outputs respectively:
model name : ARMv8 Processor rev 4 (v8l)
aarch64
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.
- 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.
- 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.
- 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
❸ Copy extracted content to /usr/bin/:
$ sudo cp docker/* /usr/bin/
( 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
❹ Create the file /etc/docker/daemon.json. We'll need to do this via sudo.
File /etc/docker/daemon.json
{
"storage-driver": "vfs",
"iptables": false,
"bridge": "none"
}
$ sudo dockerd &
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
This Portainer is listening on port 9000. On Windows 10, run a web browser with:
http://omphalos-nas-01:9000
We'll get the following screen:
Create the admin user as required. We'll get logged in:
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 .
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$
This last error was no space left on device.
⓵ 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
⓸ Modified /etc/docker/daemon.json -- add { "data-root": "/volume1/docker" }:
File /etc/docker/daemon.json
{
"storage-driver": "vfs",
"iptables": false,
"bridge": "none",
"data-root": "/volume1/docker"
}
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
It seemed to download the Portainer image again. Portainer's Volumes now shows:
❿ 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:
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
File f:\python_docker\app.py
from flask import Flask
app = Flask(__name__)
@app.route('/')
def hello_world():
return 'Hello, Docker!'
File f:\python_docker\Dockerfile
# 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"]
File f:\python_docker\requirements.txt
Flask==2.1.3
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
Then inspect it:
F:\python_docker>docker buildx inspect --bootstrap
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>
❷ Clean up https://hub.docker.com/repositories. Delete behai/python-docker image from https://hub.docker.com/repositories -- if exists.
⓵ On Windows 10 command prompt, log into https://hub.docker.com with:
F:\python_docker>docker login
⓶ Now run the build and push:
F:\python_docker>docker buildx build --platform linux/arm64 --tag behai/python-docker --push .
My successful output looks like the screen capture below:
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
It should run successfully, the output is as screen capture below:
⓶ On Windows 10, run a web browser with:
http://omphalos-nas-01:9880
It should run with no problem:
⓷ When finished testing, looks for Container ID with:
$ sudo docker ps -a
And then stop the target container with:
$ sudo docker container stop <Container ID>
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
On Windows 10, run a web browser also with:
http://omphalos-nas-01:9880
The browser should just display:
Hello, World!
❺ 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
I did run this command, it works as described.
⓶ Remove the multi-arch build profile created previously:
( F:\python_docker> )docker buildx rm mybuilder
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
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
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
❸ 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 😂😂😂
Top comments (2)
any progress with this topic? I want to install zero-tier on my NAS 218play and docker would be a solution as Zero_Tier is not supported (as well docker :()
Rafael, thank you for reading and commenting. I have not worked on this issue yet... I investigated out of interest. I have now an Ubuntu machine, so I am just playing with that.