sameersbn / docker-gitlab

Dockerized GitLab
http://www.damagehead.com/docker-gitlab/
MIT License
7.88k stars 2.14k forks source link

SMTP mail not working #1381

Open juanmao opened 7 years ago

juanmao commented 7 years ago

I use docker-compose up to install the gitlab. I have configure gmail in yml file.

but when I test email, it shows error below, does anybody have any ideas? which Name or service not known? gmail.com?

irb(main):001:0> Notify.test_email('haiba*@gmail.com', 'Message Subject', 'Message Body').deliver_now

Notify#test_email: processed outbound mail in 288.6ms

Sent mail to haiba*@gmail.com (20.9ms)
Date: Wed, 11 Oct 2017 18:57:30 +0530
From: GitLab <176208*@gmail.com>
Reply-To: GitLab <noreply@example.com>
To: haiba*@gmail.com
Message-ID: <59de1c42c8a98_2d2e3b0ac47776@1e7eea1d2334.mail>
Subject: Message Subject
Mime-Version: 1.0
Content-Type: text/html;
 charset=UTF-8
Content-Transfer-Encoding: 7bit
Auto-Submitted: auto-generated
X-Auto-Response-Suppress: All

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
<html><body><p>Message Body</p></body></html>

SocketError: getaddrinfo: Name or service not known
    from /usr/lib/ruby/2.3.0/net/smtp.rb:542:in `initialize'
    from /usr/lib/ruby/2.3.0/net/smtp.rb:542:in `open'
    from /usr/lib/ruby/2.3.0/net/smtp.rb:542:in `tcp_socket'
    from /usr/lib/ruby/2.3.0/net/smtp.rb:552:in `block in do_start'
    from /usr/lib/ruby/2.3.0/timeout.rb:91:in `block in timeout'
    from /usr/lib/ruby/2.3.0/timeout.rb:101:in `timeout'
    from /usr/lib/ruby/2.3.0/net/smtp.rb:551:in `do_start'
    from /usr/lib/ruby/2.3.0/net/smtp.rb:521:in `start'
    from /home/git/gitlab/vendor/bundle/ruby/2.3.0/gems/mail-2.6.6/lib/mail/network/delivery_methods/smtp.rb:111:in `deliver!'
    from /home/git/gitlab/vendor/bundle/ruby/2.3.0/gems/mail-2.6.6/lib/mail/message.rb:2149:in `do_delivery'
    from /home/git/gitlab/vendor/bundle/ruby/2.3.0/gems/mail-2.6.6/lib/mail/message.rb:237:in `block in deliver'
    from /home/git/gitlab/vendor/bundle/ruby/2.3.0/gems/actionmailer-4.2.8/lib/action_mailer/base.rb:543:in `block in deliver_mail'
    from /home/git/gitlab/vendor/bundle/ruby/2.3.0/gems/activesupport-4.2.8/lib/active_support/notifications.rb:164:in `block in instrument'
    from /home/git/gitlab/vendor/bundle/ruby/2.3.0/gems/activesupport-4.2.8/lib/active_support/notifications/instrumenter.rb:20:in `instrument'
    from /home/git/gitlab/vendor/bundle/ruby/2.3.0/gems/activesupport-4.2.8/lib/active_support/notifications.rb:164:in `instrument'
    from /home/git/gitlab/vendor/bundle/ruby/2.3.0/gems/actionmailer-4.2.8/lib/action_mailer/base.rb:541:in `deliver_mail'
    from /home/git/gitlab/vendor/bundle/ruby/2.3.0/gems/mail-2.6.6/lib/mail/message.rb:237:in `deliver'
    from /home/git/gitlab/vendor/bundle/ruby/2.3.0/gems/actionmailer-4.2.8/lib/action_mailer/message_delivery.rb:85:in `deliver_now'
    from (irb):1
    from /home/git/gitlab/vendor/bundle/ruby/2.3.0/gems/railties-4.2.8/lib/rails/commands/console.rb:110:in `start'
    from /home/git/gitlab/vendor/bundle/ruby/2.3.0/gems/railties-4.2.8/lib/rails/commands/console.rb:9:in `start'
    from /home/git/gitlab/vendor/bundle/ruby/2.3.0/gems/railties-4.2.8/lib/rails/commands/commands_tasks.rb:68:in `console'
    from /home/git/gitlab/vendor/bundle/ruby/2.3.0/gems/railties-4.2.8/lib/rails/commands/commands_tasks.rb:39:in `run_command!'
    from /home/git/gitlab/vendor/bundle/ruby/2.3.0/gems/railties-4.2.8/lib/rails/commands.rb:17:in `<top (required)>'
    from bin/rails:9:in `require'
    from bin/rails:9:in `<main>'

//##########update
I add  ip smtp.gmail.com  in /etc/hosts, and now it report this error.

Net::OpenTimeout: execution expired
    from /usr/lib/ruby/2.3.0/net/smtp.rb:542:in `initialize'
    from /usr/lib/ruby/2.3.0/net/smtp.rb:542:in `open'
    from /usr/lib/ruby/2.3.0/net/smtp.rb:542:in `tcp_socket'
    from /usr/lib/ruby/2.3.0/net/smtp.rb:552:in `block in do_start'
    from /usr/lib/ruby/2.3.0/timeout.rb:101:in `timeout'
    from /usr/lib/ruby/2.3.0/net/smtp.rb:551:in `do_start'
    from /usr/lib/ruby/2.3.0/net/smtp.rb:521:in `start'
    from /home/git/gitlab/vendor/bundle/ruby/2.3.0/gems/mail-2.6.6/lib/mail/network/delivery_methods/smtp.rb:111:in `deliver!'
    from /home/git/gitlab/vendor/bundle/ruby/2.3.0/gems/mail-2.6.6/lib/mail/message.rb:2149:in `do_delivery'
    from /home/git/gitlab/vendor/bundle/ruby/2.3.0/gems/mail-2.6.6/lib/mail/message.rb:237:in `block in deliver'
    from /home/git/gitlab/vendor/bundle/ruby/2.3.0/gems/actionmailer-4.2.8/lib/action_mailer/base.rb:543:in `block in deliver_mail'
    from /home/git/gitlab/vendor/bundle/ruby/2.3.0/gems/activesupport-4.2.8/lib/active_support/notifications.rb:164:in `block in instrument'
    from /home/git/gitlab/vendor/bundle/ruby/2.3.0/gems/activesupport-4.2.8/lib/active_support/notifications/instrumenter.rb:20:in `instrument'
    from /home/git/gitlab/vendor/bundle/ruby/2.3.0/gems/activesupport-4.2.8/lib/active_support/notifications.rb:164:in `instrument'
    from /home/git/gitlab/vendor/bundle/ruby/2.3.0/gems/actionmailer-4.2.8/lib/action_mailer/base.rb:541:in `deliver_mail'
    from /home/git/gitlab/vendor/bundle/ruby/2.3.0/gems/mail-2.6.6/lib/mail/message.rb:237:in `deliver'
    from /home/git/gitlab/vendor/bundle/ruby/2.3.0/gems/actionmailer-4.2.8/lib/action_mailer/message_delivery.rb:85:in `deliver_now'
    from (irb):3
    from /home/git/gitlab/vendor/bundle/ruby/2.3.0/gems/railties-4.2.8/lib/rails/commands/console.rb:110:in `start'
    from /home/git/gitlab/vendor/bundle/ruby/2.3.0/gems/railties-4.2.8/lib/rails/commands/console.rb:9:in `start'
    from /home/git/gitlab/vendor/bundle/ruby/2.3.0/gems/railties-4.2.8/lib/rails/commands/commands_tasks.rb:68:in `console'
    from /home/git/gitlab/vendor/bundle/ruby/2.3.0/gems/railties-4.2.8/lib/rails/commands/commands_tasks.rb:39:in `run_command!'
    from /home/git/gitlab/vendor/bundle/ruby/2.3.0/gems/railties-4.2.8/lib/rails/commands.rb:17:in `<top (required)>'
    from bin/rails:9:in `require'
    from bin/rails:9:in `<main>'

@@@update again @@@ it seems to be a bug of docker, but it not work after I disabled firewalld see here https://github.com/docker/compose/issues/5106

docker info
Containers: 4
 Running: 3
 Paused: 0
 Stopped: 1
Images: 5
Server Version: 1.10.3
Storage Driver: aufs
 Root Dir: /var/lib/docker/aufs
 Backing Filesystem: extfs
 Dirs: 51
 Dirperm1 Supported: true
Execution Driver: native-0.2
Logging Driver: journald
Plugins: 
 Volume: local
 Network: bridge null host
Kernel Version: 3.10.104-1-tlinux2_kvm_guest-0022.tl2
Operating System: Tencent tlinux 2.2 (Final)
OSType: linux
Architecture: x86_64
Number of Docker Hooks: 2
CPUs: 2
Total Memory: 7.674 GiB
Name: VM_245_125_centos
Registries: docker.io (secure)
uname -r
3.10.104-1-tlinux2_kvm_guest-0022.tl2
 cat /etc/centos-release
CentOS Linux release 7.2 (Final)
cat5 commented 7 years ago
SocketError: getaddrinfo: Name or service not known

DNS. It's always DNS.

solidnerd commented 6 years ago

@juanmao Is this issue still happen or can this be closed ?

juanmao commented 6 years ago

still happen

Niclas Mietz notifications@github.com于2017年11月6日 周一上午4:20写道:

@juanmao https://github.com/juanmao Is this issue still happen or can this be closed ?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/sameersbn/docker-gitlab/issues/1381#issuecomment-342002065, or mute the thread https://github.com/notifications/unsubscribe-auth/AFRvP0Vj2hsVMcDnnErLg1BNWQuOv7MPks5szhh_gaJpZM4P1fif .

solidnerd commented 6 years ago

@juanmao This is DNS problem like @cat5 said. I think some goes wrong with your firewall settings and docker. I would not recommend to use a firewall with docker only when you know what you are trying to achieve.

juanmao commented 6 years ago

but in fact after I disable the firewall, stop and up docker-compose again, it still not working.

2017-11-14 18:28 GMT+08:00 Niclas Mietz notifications@github.com:

@juanmao https://github.com/juanmao This is DNS problem like @cat5 https://github.com/cat5 said. I think some goes wrong with your firewall settings and docker. I would not recommend to use a firewall with docker only when you know what you are trying to achieve.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/sameersbn/docker-gitlab/issues/1381#issuecomment-344214008, or mute the thread https://github.com/notifications/unsubscribe-auth/AFRvP4yu1oeITXI6jhL9xCxuVPDk-hlbks5s2Ws8gaJpZM4P1fif .

cat5 commented 6 years ago

@juanmao Docker DNS usually just works, but have a look here: https://docs.docker.com/engine/userguide/networking/default_network/configure-dns/

You can also verify if you exec into the container, cat out /etc/resolv.conf and make sure it's populated correctly, and even try a ping smtp.gmail.com and see if it replies.

I'd assist more, except I run gitlab+registry on a kubernetes cluster, so my networking is different than yours.

stale[bot] commented 4 years ago

This issue has been automatically marked as stale because it has not had any activity for the last 60 days. It will be closed if no further activity occurs during the next 7 days. Thank you for your contributions.