Gitlab docker container cannot resolve DNS queries
### Summary
DNS services are not available in the gitlab/gitlab-ce:latest container when run with parameters dewcribed in [Install GitLab using Docker Engine](https://docs.gitlab.com/omnibus/docker/README.html#install-gitlab-using-docker-engine)
### Steps to reproduce
1) execute:
```bash
docker run --detach \
--hostname gitlab.gorrunyo.org \
--publish 4431:443 --publish 8081:80 --publish 2201:22 \
--name gitlab \
--restart unless-stopped \
--mount type=volume,src=gitlab-etc,dst=/etc/gitlab,volume-driver=local \
--mount type=volume,src=gitlab-log,dst=/var/log/gitlab,volume-driver=local \
--mount type=bind,src=/datapool/gitlab,dst=/var/opt/gitlab \
gitlab/gitlab-ee:latest
```
2) Modify /etc/gitlab/gitlab.rb to enable mail functions.
```ruby
### Email Settings
gitlab_rails['gitlab_email_enabled'] = true
gitlab_rails['gitlab_email_from'] = 'gitlab.domain.org'
gitlab_rails['gitlab_email_display_name'] = 'GitLab(Domain)'
gitlab_rails['gitlab_email_reply_to'] = 'noreply@gdomain.org'
gitlab_rails['gitlab_email_subject_suffix'] = ''
gitlab_rails['gitlab_email_smime_enabled'] = false
gitlab_rails['gitlab_email_smime_key_file'] = '/etc/gitlab/ssl/gitlab_smime.key'
gitlab_rails['gitlab_email_smime_cert_file'] = '/etc/gitlab/ssl/gitlab_smime.crt'
gitlab_rails['gitlab_email_smime_ca_certs_file'] = '/etc/gitlab/ssl/gitlab_smime_cas.crt'
### Reply by email
###! Allow users to comment on issues and merge requests by replying to
###! notification emails.
###! Docs: https://docs.gitlab.com/ee/administration/reply_by_email.html
gitlab_rails['incoming_email_enabled'] = true
#### Incoming Email Address
####! The email address including the `%{key}` placeholder that will be replaced
####! to reference the item being replied to.
####! **The placeholder can be omitted but if present, it must appear in the
####! "user" part of the address (before the `@`).**
gitlab_rails['incoming_email_address'] = "user+%{key}@gmail.com"
#### Email account username
####! **With third party providers, this is usually the full email address.**
####! **With self-hosted email servers, this is usually the user part of the
####! email address.**
gitlab_rails['incoming_email_email'] = "user@gmail.com"
#### Email account password
gitlab_rails['incoming_email_password'] = "password"
#### IMAP Settings
gitlab_rails['incoming_email_host'] = "imap.gmail.com"
gitlab_rails['incoming_email_port'] = 993
gitlab_rails['incoming_email_ssl'] = true
gitlab_rails['incoming_email_start_tls'] = false
#### Incoming Mailbox Settings (via `mail_room`)
####! The mailbox where incoming mail will end up. Usually "inbox".
gitlab_rails['incoming_email_mailbox_name'] = "inbox"
### GitLab email server settings
###! Docs: https://docs.gitlab.com/omnibus/settings/smtp.html
###! **Use smtp instead of sendmail/postfix.**
gitlab_rails['smtp_enable'] = true
gitlab_rails['smtp_address'] = "smtp.gmail.com"
gitlab_rails['smtp_port'] = 587
gitlab_rails['smtp_user_name'] = "user@gmail.com"
gitlab_rails['smtp_password'] = "password"
gitlab_rails['smtp_domain'] = "smtp.gmail.com"
gitlab_rails['smtp_authentication'] = "login"
gitlab_rails['smtp_enable_starttls_auto'] = true
gitlab_rails['smtp_tls'] = false
gitlab_rails['smtp_openssl_verify_mode'] = 'peer'
```
### What is the current *bug* behavior?
Gitlab cannot contact SMTP server
Open console and execute:
```bash
root@gitlab:/# ssh <local-dns-server-FQN>
ssh: Could not resolve hostname uranus: Temporary failure in name resolution
```
but when executing:
```bash
root@gitlab:/# ssh <local-dns-server-IP>
The authenticity of host 'xxx.xxx.xxx.xxx (xxx.xxx.xxx.xxx)' can't be established.
ECDSA key fingerprint is SHA256:xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Are you sure you want to continue connecting (yes/no)?
```
### What is the expected *correct* behavior?
Gitlab can access SMTP server and send emails
### Relevant logs and/or screenshots
```log
==> /var/log/gitlab/mailroom/current <==,
2020-08-03_02:57:36.36007 bundler: failed to load command: mail_room (/opt/gitlab/embedded/bin/mail_room),
2020-08-03_02:57:36.36015 SocketError: getaddrinfo: Temporary failure in name resolution,
2020-08-03_02:57:36.36016 /opt/gitlab/embedded/lib/ruby/2.6.0/socket.rb:227:in `getaddrinfo',
2020-08-03_02:57:36.36018 /opt/gitlab/embedded/lib/ruby/2.6.0/socket.rb:227:in `foreach',
2020-08-03_02:57:36.36019 /opt/gitlab/embedded/lib/ruby/2.6.0/socket.rb:631:in `tcp',
2020-08-03_02:57:36.36020 /opt/gitlab/embedded/lib/ruby/2.6.0/net/imap.rb:1132:in `tcp_socket',
2020-08-03_02:57:36.36021 /opt/gitlab/embedded/lib/ruby/2.6.0/net/imap.rb:1089:in `initialize',
2020-08-03_02:57:36.36023 /opt/gitlab/embedded/lib/ruby/gems/2.6.0/gems/gitlab-mail_room-0.0.6/lib/mail_room/connection.rb:80:in `new',
2020-08-03_02:57:36.36024 /opt/gitlab/embedded/lib/ruby/gems/2.6.0/gems/gitlab-mail_room-0.0.6/lib/mail_room/connection.rb:80:in `imap',
2020-08-03_02:57:36.36025 /opt/gitlab/embedded/lib/ruby/gems/2.6.0/gems/gitlab-mail_room-0.0.6/lib/mail_room/connection.rb:90:in `log_in',
2020-08-03_02:57:36.36027 /opt/gitlab/embedded/lib/ruby/gems/2.6.0/gems/gitlab-mail_room-0.0.6/lib/mail_room/connection.rb:72:in `setup',
2020-08-03_02:57:36.36028 /opt/gitlab/embedded/lib/ruby/gems/2.6.0/gems/gitlab-mail_room-0.0.6/lib/mail_room/connection.rb:8:in `initialize',
2020-08-03_02:57:36.36029 /opt/gitlab/embedded/lib/ruby/gems/2.6.0/gems/gitlab-mail_room-0.0.6/lib/mail_room/mailbox_watcher.rb:59:in `new',
2020-08-03_02:57:36.36032 /opt/gitlab/embedded/lib/ruby/gems/2.6.0/gems/gitlab-mail_room-0.0.6/lib/mail_room/mailbox_watcher.rb:59:in `connection',
2020-08-03_02:57:36.36033 /opt/gitlab/embedded/lib/ruby/gems/2.6.0/gems/gitlab-mail_room-0.0.6/lib/mail_room/mailbox_watcher.rb:29:in `run',
2020-08-03_02:57:36.36035 /opt/gitlab/embedded/lib/ruby/gems/2.6.0/gems/gitlab-mail_room-0.0.6/lib/mail_room/coordinator.rb:19:in `each',
2020-08-03_02:57:36.36036 /opt/gitlab/embedded/lib/ruby/gems/2.6.0/gems/gitlab-mail_room-0.0.6/lib/mail_room/coordinator.rb:19:in `run',
2020-08-03_02:57:36.36037 /opt/gitlab/embedded/lib/ruby/gems/2.6.0/gems/gitlab-mail_room-0.0.6/lib/mail_room/cli.rb:58:in `start',
2020-08-03_02:57:36.36038 /opt/gitlab/embedded/lib/ruby/gems/2.6.0/gems/gitlab-mail_room-0.0.6/bin/mail_room:5:in `<top (required)>',
2020-08-03_02:57:36.36040 /opt/gitlab/embedded/bin/mail_room:23:in `load',
2020-08-03_02:57:36.36041 /opt/gitlab/embedded/bin/mail_room:23:in `<top (required)>',
2020-08-03_02:57:36.37098 Runit: waiting 5 seconds before restarting mail_room,
```
### Output of checks
(If you are reporting a bug on GitLab.com, write: This bug happens on GitLab.com)
#### Results of GitLab environment info
<details>
<summary>Expand for output related to GitLab environment info</summary>
<pre>
(For installations with omnibus-gitlab package run and paste the output of:
`sudo gitlab-rake gitlab:env:info`)
(For installations from source run and paste the output of:
`sudo -u git -H bundle exec rake gitlab:env:info RAILS_ENV=production`)
</pre>
</details>
#### Results of GitLab application Check
<details>
<summary>Expand for output related to the GitLab application check</summary>
<pre>
Checking GitLab subtasks ...
Checking GitLab Shell ...
GitLab Shell: ... GitLab Shell version >= 13.3.0 ? ... OK (13.3.0)
Running /opt/gitlab/embedded/service/gitlab-shell/bin/check
Internal API available: OK
Redis available via internal API: OK
gitlab-shell self-check successful
Checking GitLab Shell ... Finished
Checking Gitaly ...
Gitaly: ... default ... OK
Checking Gitaly ... Finished
Checking Sidekiq ...
Sidekiq: ... Running? ... yes
Number of Sidekiq processes ... 1
Checking Sidekiq ... Finished
Checking Incoming Email ...
Incoming Email: ... Checking Reply by email ...
IMAP server credentials are correct? ... Checking gitlab.gorrunyo@gmail.com
no
Try fixing it:
An error occurred: SocketError: getaddrinfo: Temporary failure in name resolution
Check that the information in config/gitlab.yml is correct
For more information see:
doc/administration/reply_by_email.md
Please fix the error above and rerun the checks.
Init.d configured correctly? ... skipped
MailRoom running? ... skipped
Checking Reply by email ... Finished
Checking Incoming Email ... Finished
Checking LDAP ...
LDAP: ... LDAP is disabled in config/gitlab.yml
Checking LDAP ... Finished
Checking GitLab App ...
Git configured correctly? ... yes
Database config exists? ... yes
All migrations up? ... yes
Database contains orphaned GroupMembers? ... no
GitLab config exists? ... yes
GitLab config up to date? ... yes
Log directory writable? ... yes
Tmp directory writable? ... yes
Uploads directory exists? ... yes
Uploads directory has correct permissions? ... yes
Uploads directory tmp has correct permissions? ... yes
Init script exists? ... skipped (omnibus-gitlab has no init script)
Init script up-to-date? ... skipped (omnibus-gitlab has no init script)
Projects have namespace: ... can't check, you have no projects
Redis version >= 4.0.0? ... yes
Ruby version >= 2.5.3 ? ... yes (2.6.6)
Git version >= 2.22.0 ? ... yes (2.27.0)
Git user has default SSH configuration? ... yes
Active users: ... 2
Is authorized keys file accessible? ... yes
GitLab configured to store new projects in hashed storage? ... yes
All projects are in hashed storage? ... yes
Elasticsearch version 6.x - 7.x? ... skipped (elasticsearch is disabled)
Checking GitLab App ... Finished
Checking GitLab subtasks ... Finished
</pre>
</details>
### Possible fixes
(If you can, link to the line of code that might be responsible for the problem)
issue