Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Docker Version, IPv6] Failed to obtain IP Addresses! #34

Closed
SamuelBorn opened this issue Jan 16, 2024 · 5 comments
Closed

[Docker Version, IPv6] Failed to obtain IP Addresses! #34

SamuelBorn opened this issue Jan 16, 2024 · 5 comments

Comments

@SamuelBorn
Copy link

Hello @mietzen, thank you for your awesome project!

I am hosting a home server with IPv6 and encountered troubles with the docker version of this project.

Running sudo docker-compose up with the following docker-compose.yml on my Raspberry Pi

version: "3"
services:
  porkbun-ddns:
    image: "mietzen/porkbun-ddns:latest"
    container_name: porkbun-ddns
    environment:
      DOMAIN: "..." 
      SECRETAPIKEY: "..." 
      APIKEY: "..."
      FRITZBOX: "192.168.178.1" 
      SLEEP: "300" 
      IPV4: "FALSE"
      IPV6: "TRUE"
    restart: unless-stopped

I get the following error:

me@raspberrypi:~/porkbun $ sudo docker-compose up
Recreating porkbun-ddns ... done
Attaching to porkbun-ddns
porkbun-ddns    | Traceback (most recent call last):
porkbun-ddns    |   File "/entrypoint.py", line 65, in <module>
porkbun-ddns    | 2024-01-16 18:33:27,785 WARNING  Can't reach IPv6 Address! Check IPv6 connectivity!
porkbun-ddns    |     porkbun_ddns.update_records()
porkbun-ddns    |   File "/usr/local/lib/python3.12/site-packages/porkbun_ddns-0.5.0-py3.12.egg/porkbun_ddns/porkbun_ddns.py", line 142, in update_records
porkbun-ddns    |   File "/usr/local/lib/python3.12/site-packages/porkbun_ddns-0.5.0-py3.12.egg/porkbun_ddns/porkbun_ddns.py", line 102, in get_public_ips
porkbun-ddns    | porkbun_ddns.porkbun_ddns.PorkbunDDNS_Error: Failed to obtain IP Addresses!

I have verified that running the programm with IPv4 works (but is useless for me due to DS-Lite)

      IPV4: "FALSE"
      IPV6: "TRUE"

Do you have an Idea on how to fix the problem?

@mietzen
Copy link
Owner

mietzen commented Jan 16, 2024

I never tried ipv6 in docker and I'm not entirely sure that this makes sense. You would have to enable IPv6 in docker: https://docs.docker.com/config/daemon/ipv6/

But even then I would guess that the DNS Record would point to the Porkbun container. Using IPv6 inside docker only makes sense with the --public-ips option and a static ipv6 address.

If you got a DS-Lite connection you would have to run porkbun-ddns (python version) in the same VM / Host / LXC-Container as the service (e.g. nginx) you want to expose, at least that would be my understanding.

You could also build your own docker container with nginx and porkbun-ddns and enable IPv6, but I guess when you want to stick with docker it would be way easier to use caddy with the dynamic_dns module.

@SamuelBorn
Copy link
Author

SamuelBorn commented Jan 16, 2024

I already had IPv6 enabled for docker (the default bridge) so this most likely is not issue.
I am unfortunately also no networking expert, so I am no huge help in this regard.

For now I am just using the pure python version of the project - which runs fine.

Maybe flag the IPv6 option of the Docker container as experimental or something like that for now.

@mietzen
Copy link
Owner

mietzen commented Jan 16, 2024

Maybe flag the IPv6 option of the Docker container as experimental or something like that for now.

👍 I'll added to the docs. I'll also have a look at this the next days, the main problem seems to be that urllib.request.urlopen('https://v6.ident.me').read().decode('utf8') fails with a URLError, so https://v6.ident.me might not be reachable, so my first guess was that IPv6 isn't enabled.

@mietzen
Copy link
Owner

mietzen commented Jan 17, 2024

This is a docker-compose problem:

https://forums.docker.com/t/solution-docker-ipv6-and-docker-compose-woes/97852

docker run works flawlessly:

$ docker run -e DOMAIN="my-domain.de" -e SUBDOMAINS="abs,asw" -e SECRETAPIKEY="xxx" -e APIKEY="xxx" -e IPV4="False" -e IPV6="True" -it mietzen/porkbun-ddns:latest     
2024-01-17 04:54:29,673 INFO     AAAA-Record of abs.my-domain.de is up to date!
2024-01-17 04:54:31,190 INFO     AAAA-Record of asw.my-domain.de is up to date!
2024-01-17 04:54:31,190 INFO     Sleeping... 300s```

@mietzen mietzen closed this as completed Jan 17, 2024
mietzen added a commit that referenced this issue Jan 17, 2024
@SamuelBorn
Copy link
Author

Yep, verified it on my machine. Docker run works.
Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants