Today in our NGINX Proxy Manager Tutorial which is Episode 7 in our Raspberry Pi Series. We will be looking at how to set up a fully qualified domain name (FQDN) that will point to our Raspberry Pi and will work with our Docker container applications.
To Achieve this we will be using a free online Dynamic DNS service called DuckDNS and a Linuxserver.io DuckDNS Docker container compatible with the Raspberry Pi.
Difficulty = Medium
What is Dynamic DNS?
With most home internet services providers (ISP), they allocate to their customers a dynamic IP addresses. What this means is the public IP address assigned to your home internet connection will change in line with a lease period.
What else can make your IP change?.
What can also cause an IP change is if your Internet Router or Modem has to be restarted. A fresh Public IP address will then be assigned.
This becomes a problem for a home server environment because the IP address that has changed will need to be updated with the domain registrar in the form of an A entry.
If this update does not occur then your domain visitors will be unable to make a connection with your network/service and the only way to re-establish this would be to manually update the A Entry with the new IP address at the domain registrar.
To do this manually every time the IP changes would be impractical so we will need to automate the process. This is where DuckDNS comes in.
Do I have to use DuckDNS?
There are exceptions and times that a DDNS service would not be required and this mostly occurs in the business world. Your ISP can issue your network with a static public IP address which means your IP address will never change.
This service is usually a paid-for extra. However, if your IP doesn’t change you should check with your ISP to confirm your IP is static before setting up any direct public-facing server or service.
Duckdns does not require the use of a private domain name. It uses subdomains to forward its DDNS service. If you are looking to use your own private domain then I would recommend using Cloudflare rather than DuckDNS.
So in a nutshell if your ISP has issued you with a Static IP. You do not need to use any DDNS services including DuckDNS.
Our Dynamic DNS solution
We will require an additional Docker container that will monitor your Public IP address locally for any changes. If it notices that your Public IP has changed it will automatically update the IP A record on the online DuckDNS service website.
DUCKDNS Installation Guide
Step 1: Set up a Duckdns account.
The First thing to do will be to set up a DuckDNS account which is easy.
Just navigate to their homepage and log in using one of the many sign in options they offer. In our example we use Google.
Step 2: Enter a Duckdns subdomain.
Once logged in we are going to create a subdomain by entering into the white box a name you would like to use for your service.
Note: You will need to create a new subdomain for each docker container service you host.
In our example, we just put in “a2t“. Then click on the green “add domain” button.
This now gives us a domain name to use. In our case it is a2t.duckdns.org.
The DuckDNS service will automatically take the public IP address you are currently on and add this to the IP field. If you are using a VPN, proxy or are using any other network that is different from the one you want to host your service on you will need to update this IP manually to start with to ensure the correct IP address is used. (This will be auto-updated later by our DuckDNS container either way).
Step 3: Create and deploy the Duckdns container using a stack.
Now we have our subdomain we are going to “log in” to our “Portainer” dashboard on our Raspberry Pi and navigate to the “Stacks” page:
From there we are going click on the “Add stack” button.
This will open up a new Stack creation window. We will then name our stack “duckdns“
Then in the Web editor we will paste the following Docker compose data into the empty field.
Docker Compose Stack:
--- version: "2.1" services: duckdns: image: ghcr.io/linuxserver/duckdns container_name: duckdns environment: - PUID=1000 #optional - PGID=1000 #optional - TZ=Europe/London - SUBDOMAINS=subdomain1,subdomain2 - TOKEN=token - LOG_FILE=false #optional volumes: - /path/to/appdata/config:/config #optional restart: unless-stopped
You will then need to change the fields to match your installation. If you would like to use a specific user account then you will need to find the PUID and GUID of that user account. We have shown how to do this in our Youtube Video so please watch that. If you would like to go with the defaults just remove both these fields as they are optional.
Set your timezone “TZ” to your current location.
Add your subdomain name to the “SUBDOMAIN” field. If you have more than one you will need to add an entry for each subdomain you wish to use and separate them with a comma.
Note you do not need to add the full domain name only the subdomain part. In our example, we would only put “a2t” into the “SUBDOMAIN” field. not a2t.duckdns.org.
Add your Token to the TOKEN field, which can be found on the Duckdns subdomain creation page at the top right. This is unique to every user and only needs to be put in once regardless of how many subdomains you use.
If you would like to use logs then you can change the field to “true” this is optional.
Under Volumes add the location of where you install all your Docker data.
Now you have set them fields your Docker compose Stack should look something like this:
Now you have confirmed all is set up correctly you can press the “Deploy the stack” button.
You can now check the Portainer containers page to confirm the “duckdns” container has been created correctly.
Press the Logs button to check all is as expected. It should look like this:
To confirm your domain is working correctly you can open a browser window and enter your domain name into the address field.
You should now see this:
This concludes today’s Tutorial.
In our next episode, we will be installing and configuring Nginx Proxy Manager to use Cloudflare’s DDNS service and setting a custom Domain. Don’t miss out! Subscribe to your Youtube channel and click the notification bell to be notified when new content goes live.
We need your support.
We hope you enjoyed this episode and that it was helpful and you got benefit out of it.
If you did, please consider supporting our channel by Subscribing to our YouTube channel, and liking and sharing our content.
You can also make a donation via Paypal or become a Patreon if you wish to do so.
You can also follow us on Facebook or Twitter.
If you have any questions or any requests please ask in the comments below or on YouTube.
Thank You for your wonderful sessions
I am getting the following error message
[s6-init] making user provided files available at /var/run/s6/etc…exited 0.
[s6-init] ensuring user provided files have correct perms…exited 0.
[fix-attrs.d] applying ownership & permissions fixes…
[cont-init.d] executing container initialization scripts…
[cont-init.d] 01-envfile: executing…
[cont-init.d] 01-envfile: exited 0.
[cont-init.d] 10-adduser: executing…
| | ___ _ __
| | / __| | | / \
| | \__ \ | | | () |
|_| |___/ |_| \__/
Brought to you by linuxserver.io
To support the app dev(s) visit:
To support LSIO projects visit:
User uid: 1002
User gid: 100
Your DockerHost is running an outdated version of libseccomp
To fix this, please visit https://docs.linuxserver.io/faq#libseccomp
Apps will not behave correctly without this
I am a noob
If you have problems try the following:
If you are running Raspberry Pi OS (Legacy) based on Buster you may need to apply the following in the terminal.
This will enable the backported version of libseccomp2 which will allow the Radarr container to work correctly.
sudo apt-key adv –keyserver keyserver.ubuntu.com –recv-keys 04EE7237B7D453EC 648ACFD622F3D138
echo “deb http://deb.debian.org/debian buster-backports main” | sudo tee -a /etc/apt/sources.list.d/buster-backports.list
sudo apt update
sudo apt install -t buster-backports libseccomp2
Hello would this work if say my computer was running like next cloud for example and my raspberry pi was the server for my nginx , duck dns and cloudflare and I pointed my next cloud from my pi to the pc’s up address or does it all have to be on the same device?
Hello and thanks a lot for your Pi series guiding!
I have a problem already to connect duckdns.org, when I go there so coming my router site where I should log in.
Maybe it because my Raspberry Pi connect with lan to mesh router which is connected with lan to main router.
I asked my ISP and I have a dynamic IP. How can I solve this problem?