Synology Docker Port

Hi,

Port settings are used to open the container within a browser. This should be left to the default value since Calibre-web will be looking for this port. Local Port needs to be changed from Auto to the matching Container Port. If this is not done, your machine may use a random port each time and cause confusion.

I am in the process of moving my openhab installation from Windows to a Synology docker container. Now I run into a problem where someone might have a solution.

  • This is a stark difference from Synology’s Docker GUI, as you can back up the important container data, but you can’t port it over to a different operating system easily. A few downsides of Docker Compose on a Synology NAS: Everything is done through the command-line interface (CLI).
  • Syncthing docker port setup. Posted by 1 year ago. Synology 920+ for about 350 euro (still in warranty). The only bummer is just 1GbE ports.

When trying if the rest api is running as expected in a browser with:
http://synologyIP:8445/rest/items
I get just some ASCII symobls shown: P
Trying the same with https
https://synologyIP:8445/rest/items
I get all items shown after I confirmed to load the page ignoring the certificate error

Using https in VS Code produces an error (I saw a github entry that accessing rest api by https is currently not working.)
If I use just the ip (so http) I get:

Error while connecting to openHAB REST API. Parse Error

Which is clear if vs code gets the same ascii chars I see in the browser.

I also tried port 8080 but this seems to lead to my Synology directly and brings a

HTTP Status 404 – Not Found

Is there a different port I should use?
No sure if I can map the ports in my Synology since I used the Synology Docker GUI and can’t find a port mapping there. Even if there would be one I am unsure which ports should be mapped to what.

Range

I would be fine to not access it with https and use http instead but I have no idea what the problem is since even the call from a browser is not working and I just get those ascii characters.

Any hint is much appretiated since I don’t wan’t to go back to my Windows setup.

NoTechi
PS I am using latest stable docker openhab and latest openhab vs code plugin

Now the image is in Docker Hub, you can enable Docker support on the Synology NAS, pull the image from Docker Hub, and start a container on the NAS. First log into the Synology as an admin account and open the Package Center. Here you can search for “Docker” and install the Docker app. The benefits of running the Ubiquiti UniFi controller in Docker on the Synology NAS is that it’s free (if you already own the Synology NAS) and super simple to setup. Depending on your Synology specs, such as a Synology DS1815+, you could easily manage several access points and sites using the docker UniFi controller and upgrading to 16GB.

Docker runs in a separate network by default called a docker bridge network, which makes DHCP want to serve addresses to that network and not your LAN network where you probably want it. This document details why Docker Pi-hole DHCP is different from normal Pi-hole and how to fix the problem.

Technical details¶

Docker's bridge network mode is default and recommended as a more secure setting for containers because docker is all about isolation, they isolate processes by default and the bridge network isolates the networking by default too. You gain access to the isolated container's service ports by using port forwards in your container's runtime config; for example -p 67:67 is DHCP. However, DHCP protocol operates through a network 'broadcast' which cannot span multiple networks (docker's bridge, and your LAN network). In order to get DHCP on to your network there are a few approaches:

Working network modes¶

Eclipse Mosquitto is an open source message broker which implements MQTT version 5, 3.1.1 and 3.1. Synology NAS has official support for Docker. Docker can be an alternative to virtual machines. If you don't have enough memory to run virtual machines on your Synology NAS, you can run Docker containers instead. Docker containers require a very little amount of memory and system resources to run.

Here are details on setting up DHCP for Docker Pi-hole for various network modes available in docker.

Docker Pi-hole with host networking mode¶

Advantages: Simple, easy, and fast setup

Possibly the simplest way to get DHCP working with Docker Pi-hole is to use host networking which makes the container be on your LAN Network like a regular Raspberry Pi-hole would be, allowing it to broadcast DHCP. It will have the same IP as your Docker host server in this mode so you may still have to deal with port conflicts.

  • Inside your docker-compose.yml remove all ports and replace them with: network_mode: host
  • docker run --net=host if you don't use docker-compose

Docker Pi-hole with a Macvlan network¶

Advantages: Works well with NAS devices or hard port conflicts

Synology

A Macvlan network is the most advanced option since it requires more network knowledge and setup. This mode is similar to host network mode but instead of borrowing the IP of your docker host computer it grabs a new IP address off your LAN network.

Having the container get its own IP not only solves the broadcast problem but avoids port conflicts you might have on devices such as NAS devices with web interfaces. Tony Lawrence detailed macvlan setup for Pi-hole first in the second part of his great blog series about Running Pi-hole on Synology Docker, check it out here: Free your Synology ports with Macvlan

Docker

Synology Docker Port List

DockerSynology docker port

Docker Pi-hole with a bridge networking¶

Advantages: Works well with container web reverse proxies like Nginx or Traefik

If you want to use docker's bridged network mode then you need to run a DHCP relay. A relay points to your containers forwarded port 67 and spreads the broadcast signal from an isolated docker bridge onto your LAN network. Relays are very simple software, you just have to configure it to point to your Docker host's IP port 67.

Although uncommon, if your router is an advanced enough router it may support a DHCP relay. Try googling for your router manufacturer + DHCP relay or looking in your router's configuration around the DHCP settings or advanced areas.

If your router doesn't support it, you can run a software/container based DHCP relay on your LAN instead. The author of dnsmasq made a very tiny simple one called DHCP-helper. DerFetzer kindly shared his great setup of a DHCP-helper container on the Pi-hole Discourse forums.

Warning about the Default bridge network¶

Best Docker Containers For Synology

The out of the box default bridge network has some limitations that a user created bridge network won't have. These limitations make it painful to use especially when connecting multiple containers together.

Synology Docker Port Conflict

Docker Images For Synology

Best Docker Packages For Synology

Avoid using the built-in default docker bridge network, the simplest way to do this is just use a docker-compose setup since it creates its own network automatically. If compose isn't an option the bridge network docs should help you create your own.