Skip to content

"smtp.gmail.com: i/o timeout" but can ping, nslookup and nc to the server just fine from the container #648

@bverkron

Description

@bverkron

What are you trying to do?
Send SMTP notifications. They were working before with this exact config but no longer work after rebuilding the host.

What is your current configuration?

  backup:
    # https://github.com/offen/docker-volume-backup#readme
    image: offen/docker-volume-backup:latest
    container_name: $APP_NAME-backup
    depends_on:
      - $APP_NAME
    environment:
      BACKUP_CRON_EXPRESSION: $BACKUP_CRON_EXPRESSION
      BACKUP_RETENTION_DAYS: $BACKUP_RETENTION_DAYS
      BACKUP_EXCLUDE_REGEXP: $BACKUP_EXCLUDE_REGEXP
      BACKUP_FILENAME: $APP_NAME-backup-%Y-%m-%dT%H-%M-%S.tar.gz
      BACKUP_PRUNING_PREFIX: $APP_NAME-backup-
      NOTIFICATION_URLS: $NOTIFICATION_URLS
      NOTIFICATION_LEVEL: info
      GPG_PASSPHRASE: $GPG_PASSPHRASE
      AWS_S3_BUCKET_NAME: $AWS_S3_BUCKET_NAME
      AWS_S3_PATH: $APP_NAME
      AWS_ENDPOINT: $AWS_ENDPOINT
      AWS_ACCESS_KEY_ID: $AWS_ACCESS_KEY_ID
      AWS_SECRET_ACCESS_KEY: $AWS_SECRET_ACCESS_KEY
    volumes:
      # Standard config    
      - /var/run/docker.sock:/var/run/docker.sock:ro
      - /etc/timezone:/etc/timezone:ro
      - /etc/localtime:/etc/localtime:ro
      - /media/ext_storage/backups/$APP_NAME/:/archive/
      - $APP_DATA_PATH/:/backup/:ro
    restart: unless-stopped

Log output

time=2025-10-11T12:59:16.327-07:00 level=ERROR msg="Fatal error running command: main.(*script).runHooks: error running hook: main.(*script).notify: error sending notification: main.(*script).sendNotification: error sending message: error getting SMTP client: error connecting to server: dial tcp: lookup smtp.gmail.com: i/o timeout" error="main.(*command).runAsCommand: error running script: main.runScript.func4: the script ran successfully, but an error occurred calling the registered hooks: main.(*script).runHooks: error running hook: main.(*script).notify: error sending notification: main.(*script).sendNotification: error sending message: error getting SMTP client: error connecting to server: dial tcp: lookup smtp.gmail.com: i/o timeout"

~ # nslookup smtp.gmail.com
Server:         127.0.0.11
Address:        127.0.0.11:53

Non-authoritative answer:
Name:   smtp.gmail.com
Address: 2607:f8b0:400e:c09::6d

Non-authoritative answer:
Name:   smtp.gmail.com
Address: 192.178.163.108

~ # ping smtp.gmail.com
PING smtp.gmail.com (74.125.195.109): 56 data bytes
64 bytes from 74.125.195.109: seq=0 ttl=108 time=17.403 ms
64 bytes from 74.125.195.109: seq=1 ttl=108 time=17.345 ms
64 bytes from 74.125.195.109: seq=2 ttl=108 time=16.507 ms

--- smtp.gmail.com ping statistics ---
3 packets transmitted, 3 packets received, 0% packet loss
round-trip min/avg/max = 16.507/17.085/17.403 ms

~ # nc -vz smtp.gmail.com 587
smtp.gmail.com (74.125.195.109:587) open

Additional context
I recently had to rebuild my docker host and went from Ubuntu to Debian. This most likely has something to do with the new host but I cannot figure out what.

DNS works on the new host and in every other container aside from offen backup. My manual tests above show that the offen backup container resolves the Gmail SMTP server and can connect but for some reason offen backup itself cannot? I have another host in the same VLAN that is still working as expected so it's not a broader network issue either.

I'm using the identical compose file on this new host as I as before and it's identical to a compose file on another host on the same VLAN that also works fine and gets the same results from all the checks above (nslookup, ping, nc, etc)

A bit stumped on where to go from here. Are there some go or offen specific commands I can run to debug?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions