0

I was looking for a software like No-IP to dynamically update my IP using a free domain from them like <domain>.zapto.org, but this time for setting up with docker containers. So I found about duckdns and tried setting it up.

Well, perhaps I got it wrong, but as per what I understood, I can create a service within my docker-compose services setting up the linuxserver/duckdns. When I do that, I suppose that I can then access my other services from that same compose using the domain created on duckdns, is that right?

For instance, I got this docker-compose:

version: "3.9"

services:
  dns_server:
    image: linuxserver/duckdns:version-13f609b7
    restart: always
    environment:
      TOKEN: ${DUCKDNS_TOKEN}
      TZ: ${TZ}
      SUBDOMAINS: ${DUCKDNS_SUBDOMAINS}
    depends_on:
      - server
      - db
      - phpmyadmin

  server:
    # ...
    restart: always
    ports:
      - "7171:7171"
      - "7172:7172"
    # ...
    command: sh -c "/wait && screen -S tfs ./tfs"

  # Database
  db:
    image: bitnami/mariadb:10.8.7-debian-11-r1
    restart: always
    ports:
      - "3306:3306"
    # ...

  # phpmyadmin
  phpmyadmin:
    # ...
    image: bitnami/phpmyadmin:5.2.1-debian-11-r1
    restart: always
    ports:
      - "8080:8080"
      - "8443:8443"
    # ...

That compose gives me these containers running: containers

When I try to reach my server service by using 127.0.0.1:7171 or localhost:7171, and also access my phpmyadmin by 127.0.0.1:8080, it works, but it doesn't when I try using <mydomain>.duckdns.org:7171 or <mydomain>.duckdns.org:8080

What is wrong?

João Casarin
  • 674
  • 2
  • 9
  • 27

1 Answers1

0

As I know, when you define the port - "7171:7171" like this it will bound to your localhost 127.0.0.1, which you can access. If you want to allow public access try something like

server:
  ports:
    - "0.0.0.0:7171:7171"
    - "0.0.0.0:7172:7172"

And you can access the port via your Public IP address or hostname of duckDNS.

FYI: Beware of the security risks of exposing the code to the public.

Abdulla Nilam
  • 36,589
  • 17
  • 64
  • 85