boredazfcuk / docker-icloudpd

An Alpine Linux container for the iCloud Photos Downloader command line utility
1.58k stars 149 forks source link

Bark startup notification failed with http status code: 000 and curl exit code: 6 #528

Closed mhqschen closed 1 month ago

mhqschen commented 3 months ago

Logs:

2024-03-22 13:30:38 INFO     ***** boredazfcuk/icloudpd container for icloud_photo_downloader v1.0.718 started *****
2024-03-22 13:30:38 INFO     ***** For support, please go here: https://github.com/boredazfcuk/docker-icloudpd *****
……
2024-03-22 13:31:01 INFO     Bark notifications enabled
2024-03-22 13:31:01 INFO     Bark device key: xxxxxxxx
2024-03-22 13:31:01 INFO     Bark server: https://api.day.app:443
2024-03-22 13:31:01 INFO     Sending Bark startup notification
2024-03-22 13:31:01 ERROR    Bark startup notification failed with http status code: 000 and curl exit code: 6

Settings:

bark_device_key="xxxxxxxx"
bark_server="https://api.day.app:443"
notification_type=Bark

Attach the container and run curl:

# curl https://api.day.app/xxxxxxxx/test
{"code":200,"message":"success","timestamp":1711085706}/
Arnold4869 commented 3 months ago

我之前配置的时候使用域名不行,使用192.168开头的内网ip可以

boredazfcuk commented 3 months ago

curl exit code 6 is "host not found" The :443 should be unnecessary when using https:// prefix. Try removing that so the configuration in the container is the same as your test from the command line.

mhqschen commented 3 months ago

curl exit code 6 is "host not found" The :443 should be unnecessary when using https:// prefix. Try removing that so the configuration in the container is the same as your test from the command line.

No luck. I've tried both below two kind of settings. Got same error message.

bark_server="https://api.day.app/"
bark_server="https://api.day.app"
2024-04-03 10:54:31 INFO     Bark notifications enabled
2024-04-03 10:54:31 INFO     Bark device key: XXXXXX
2024-04-03 10:54:31 INFO     Bark server: https://api.day.app
2024-04-03 10:54:31 INFO     Sending Bark startup notification
2024-04-03 10:54:31 ERROR    Bark startup notification failed with http status code: 000 and curl exit code: 6
2024-04-03 10:54:31 ERROR    ***** Please report problems here: https://github.com/boredazfcuk/docker-icloudpd/issues *****
mhqschen commented 3 months ago

Here's my docker compose file, should has nothing related with this error.

version: '3.3'
services:
    icloudpd:
        container_name: icloudpd
        network_mode: bridge
        restart: always
        environment:
            - TZ=Asia/Shanghai
        volumes:
            - '/xxx/icloudpd/config:/config'
            - '/xxxxx:/home/user/iCloud'
        image: boredazfcuk/icloudpd
boredazfcuk commented 3 months ago

You've not created a network for the container. Try that:

https://github.com/boredazfcuk/docker-icloudpd/blob/master/CONFIGURATION.md#creating-a-container

mhqschen commented 3 months ago

You've not created a network for the container. Try that:

https://github.com/boredazfcuk/docker-icloudpd/blob/master/CONFIGURATION.md#creating-a-container

Thanks for the hint. I've directly used the code in this file to create a network.

docker network create \
   --driver=bridge \
   --subnet=192.168.115.0/24 \
   --gateway=192.168.115.254 \
   --opt com.docker.network.bridge.name=icloudpd_br0 \
   icloudpd_bridge

And then modified the docker compose file to use this network.

version: '3.3'
services:
    icloudpd:
        container_name: icloudpd
        networks:
            - icloudpd_bridge
        restart: always
        environment:
            - TZ=Asia/Shanghai
        volumes:
            - '/xxx/icloudpd/config:/config'
            - '/xxxxx:/home/user/iCloud'
        image: boredazfcuk/icloudpd
networks:
    icloudpd_bridge:
        external: true
        name: icloudpd_bridge          

Can confirm that the container is using the network. image

However, the DNS failed totally after I start the container, can't find host even when attach the container.

After adding the DNS info, the problem back to before😢( Can curl when attaching but get code 6 by icloudpd itself).

    dns:
      - 223.5.5.5
boredazfcuk commented 2 months ago

I create mine with a single docker-compose.yml like this:

version: "3.7"

networks:
   containers:
      name: containers
      external: true
      driver: bridge
      ipam:
         driver: default
         config:
            - subnet: 192.168.99.0/24
      driver_opts:
         com.docker.network.bridge.name: containers0

volumes:
   icloudpd_boredazfcuk_config:
      name: icloudpd_boredazfcuk_config

 icloudpd_boredazfcuk:
    hostname: icloudpd_boredazfcuk
    container_name: icloudpd_boredazfcuk
    networks:
       - containers
    environment:
       - TZ=Europe/London
    image: boredazfcuk/icloudpd
    healthcheck:
       test: /usr/local/bin/healthcheck.sh
       start_period: 630s
    restart: always
    volumes:
       - icloudpd_boredazfcuk_config:/config/
       - /mnt/icloudpd/boredazfcuk/iCloud:/home/boredazfcuk/iCloud/

DNS works fine. What version of Docker are you using? It should be listed on the Portainer home page.

mhqschen commented 2 months ago

I've tried again with your docker compose file. The network is not an existing one, so I need to comment the "external: true" to make it workable. The rest code for network part is exactly same as yours. But still not working..

version: "3.7"

services:
 icloudpd:
    hostname: icloudpd
    container_name: icloudpd
    networks:
       - containers
    environment:
       - TZ=Asia/Shanghai
    image: boredazfcuk/icloudpd
    healthcheck:
       test: /usr/local/bin/healthcheck.sh
       start_period: 630s
    restart: always
    volumes:
       - '/xxx/icloudpd/config:/config'
       - '/xxxxx:/home/user/iCloud'

networks:
   containers:
      name: containers
      #external: true
      driver: bridge
      ipam:
         driver: default
         config:
            - subnet: 192.168.99.0/24
      driver_opts:
         com.docker.network.bridge.name: containers0

My docker version:

Client:
 Version:           20.10.27-qnap1
 API version:       1.41
 Go version:        go1.19.12
 Git commit:        662936b
 Built:             Mon Dec 25 08:41:44 2023
 OS/Arch:           linux/amd64
 Context:           default
 Experimental:      true

Server: Docker Engine - Community
 Engine:
  Version:          20.10.27-qnap1
  API version:      1.41 (minimum version 1.12)
  Go version:       go1.20.10
  Git commit:       8a4e2cd
  Built:            Mon Dec 25 08:42:51 2023
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          v1.6.22
  GitCommit:        8165feabfdfe38c65b599c4993d227328c231fca
 runc:
  Version:          1.1.8
  GitCommit:        v1.1.8-0-g82f18fe0
 docker-init:
  Version:          0.19.0
  GitCommit:        de40ad0
boredazfcuk commented 2 months ago

Seems like an older version of Docker, but not old enough that it would cause issue. I'll have used that version with this config at some point.

Mine is a fair few versions in front though:


Client: Docker Engine - Community
 Version:           25.0.4
 API version:       1.44
 Go version:        go1.21.8
 Git commit:        1a576c5
 Built:             Wed Mar  6 16:32:14 2024
 OS/Arch:           linux/amd64
 Context:           default

Server: Docker Engine - Community
 Engine:
  Version:          25.0.4
  API version:      1.44 (minimum version 1.24)
  Go version:       go1.21.8
  Git commit:       061aa95
  Built:            Wed Mar  6 16:32:14 2024
  OS/Arch:          linux/amd64
  Experimental:     true
 containerd:
  Version:          1.6.28
  GitCommit:        ae07eda36dd25f8a1b98dfbf587313b99c0190bb
 runc:
  Version:          1.1.12
  GitCommit:        v1.1.12-0-g51d5e94
 docker-init:
  Version:          0.19.0
  GitCommit:        de40ad0

When you're inside the container, does the DNS server even respond to nslookup? What do you get from that? The DNS server should respond on 127.0.0.11 and you should see this configured in /etc/resolv.conf

mhqschen commented 2 months ago

Here's the infomation I get when I've attached the container.

/ # cat /etc/resolv.conf
nameserver 127.0.0.11
options ndots:0
/ # nslookup api.day.app
Server:         127.0.0.11
Address:        127.0.0.11#53

Non-authoritative answer:
Name:   api.day.app
Address: 43.155.109.24
/ # curl https://api.day.app/xxxx/test
{"code":200,"message":"success","timestamp":1712546237}/ #

On the meanwhile, the icloudpd is still be blocked with same error:

2024-04-08 11:17:23 INFO     Sending Bark startup notification
2024-04-08 11:17:23 ERROR    Bark startup notification failed with http status code: 000 and curl exit code: 6
2024-04-08 11:17:23 ERROR    ***** Please report problems here: https://github.com/boredazfcuk/docker-icloudpd/issues *****
boredazfcuk commented 2 months ago

Can you try: nslookup -v api.day.app

mhqschen commented 2 months ago

Seems the nslookup in this container doesn't support this option. Even don't support "help".

/ # nslookup -v api.day.app
*** Invalid option: v
Server:         127.0.0.11
Address:        127.0.0.11#53

Non-authoritative answer:
Name:   api.day.app
Address: 43.155.109.24
boredazfcuk commented 2 months ago
2024-03-22 13:31:01 INFO     Bark server: https://api.day.app:443

The bark_server variable should just be the server, nothing else. By setting it as you have, the notification URL becomes:

http://https://api.day.app:443/push
mhqschen commented 1 month ago

What shall I put in config? Still get error when set like this: bark_server="api.day.app:443"

024-05-06 10:19:10 INFO     Bark server: api.day.app:443
2024-05-06 10:19:10 INFO     Sending Bark startup notification
2024-05-06 10:19:11 ERROR    Bark startup notification failed with http status code: 400 and curl exit code: 0
mhqschen commented 1 month ago

Finally……it turn out to be no need to add either "https" or "443" in the config…… Just…… bark_server="api.day.app" Then works like a charm.