Skip to content

Docker image does not contain sendmail

Summary

The latest Docker image for GitLab 9.4.1 (gitlab-ce@6678b4e5a64696f70f88345f1b9d93def9912fa2) lacks the /usr/sbin/sendmail binary, which is required to send mails using the default method.

Steps to reproduce

  • Deploy with docker-compose, using the docker-compose.yml provided in the doc.

  • Unomment the following lines in gitlab.rb:

gitlab_rails['gitlab_email_enabled'] = true
gitlab_rails['gitlab_email_from'] = 'example@example.com'
gitlab_rails['gitlab_email_display_name'] = 'Example'
gitlab_rails['gitlab_email_reply_to'] = 'noreply@example.com'
gitlab_rails['gitlab_email_subject_suffix'] = ''
  • Enter the console (docker exec -it gitlab_web_1 gitlab-rails console), send a test mail as explained here:
irb(main):003:0> Notify.test_email('destination_email@address.com', 'Message Subject', 'Message Body').deliver_now

What is the current bug behavior?

The previous command returns:

Notify#test_email: processed outbound mail in 1291.4ms
sh: 1: /usr/sbin/sendmail: not found

and the mail never reaches its destination.

What is the expected correct behavior?

/usr/sbin/sendmail exists in the Docker image, and the mail reaches its destination.

Results of GitLab environment info

Expand for output related to GitLab environment info
$ docker exec -it gitlab_web_1 gitlab-rake gitlab:env:info

System information System: Current User: git Using RVM: no Ruby Version: 2.3.3p222 Gem Version: 2.6.6 Bundler Version:1.13.7 Rake Version: 10.5.0 Redis Version: 3.2.5 Git Version: 2.13.0 Sidekiq Version:5.0.0 Go Version: unknown

GitLab information Version: 9.4.1 Revision: 6678b4e Directory: /opt/gitlab/embedded/service/gitlab-rails DB Adapter: postgresql URL: http://git.pelouze.net:9090 HTTP Clone URL: http://git.pelouze.net:9090/some-group/some-project.git SSH Clone URL: ssh://git@git.pelouze.net:2222/some-group/some-project.git Using LDAP: no Using Omniauth: no

GitLab Shell Version: 5.3.1 Repository storage paths:

  • default: /var/opt/gitlab/git-data/repositories Hooks: /opt/gitlab/embedded/service/gitlab-shell/hooks Git: /opt/gitlab/embedded/bin/git

Results of GitLab application Check

Expand for output related to the GitLab application check
$ docker exec -it gitlab_web_1 gitlab-rake gitlab:check SANITIZE=true
Checking GitLab Shell ...

GitLab Shell version >= 5.3.1 ? ... OK (5.3.1) Repo base directory exists? default... yes Repo storage directories are symlinks? default... no Repo paths owned by git:root, or git:git? default... yes Repo paths access is drwxrws---? default... yes hooks directories in repos are links: ... 2/3 ... ok 2/4 ... ok 2/5 ... ok 2/7 ... ok 2/11 ... ok 7/12 ... repository is empty 2/13 ... ok 2/14 ... ok 2/19 ... ok 2/20 ... ok 5/21 ... ok 2/23 ... ok 7/24 ... ok 5/25 ... ok 7/26 ... ok 7/27 ... ok 2/28 ... ok 2/29 ... ok 8/30 ... ok 8/31 ... ok 8/32 ... ok 5/34 ... ok 5/35 ... ok 5/36 ... ok 2/37 ... ok 2/38 ... ok 2/39 ... ok 2/40 ... ok 2/41 ... ok 5/43 ... ok 2/44 ... ok 2/46 ... ok 5/48 ... ok 2/49 ... ok 2/52 ... ok 5/53 ... ok Running /opt/gitlab/embedded/service/gitlab-shell/bin/check Check GitLab API access: FAILED: Failed to connect to internal API gitlab-shell self-check failed Try fixing it: Make sure GitLab is running; Check the gitlab-shell configuration file: sudo -u git -H editor /opt/gitlab/embedded/service/gitlab-shell/config.yml Please fix the error above and rerun the checks.

Checking GitLab Shell ... Finished

Checking Sidekiq ...

Running? ... yes Number of Sidekiq processes ... 1

Checking Sidekiq ... Finished

Checking Reply by email ...

Reply by email is disabled in config/gitlab.yml

Checking Reply by email ... Finished

Checking LDAP ...

LDAP is disabled in config/gitlab.yml

Checking LDAP ... Finished

Checking GitLab ...

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: ... 2/3 ... yes 2/4 ... yes 2/5 ... yes 2/7 ... yes 2/11 ... yes 7/12 ... yes 2/13 ... yes 2/14 ... yes 2/19 ... yes 2/20 ... yes 5/21 ... yes 2/23 ... yes 7/24 ... yes 5/25 ... yes 7/26 ... yes 7/27 ... yes 2/28 ... yes 2/29 ... yes 8/30 ... yes 8/31 ... yes 8/32 ... yes 5/34 ... yes 5/35 ... yes 5/36 ... yes 2/37 ... yes 2/38 ... yes 2/39 ... yes 2/40 ... yes 2/41 ... yes 5/43 ... yes 2/44 ... yes 2/46 ... yes 5/48 ... yes 2/49 ... yes 2/52 ... yes 5/53 ... yes Redis version >= 2.8.0? ... yes Ruby version >= 2.3.3 ? ... yes (2.3.3) Git version >= 2.7.3 ? ... yes (2.13.0) Active users: ... 5

Checking GitLab ... Finished

gitlab-shell self-check fails. Although this might be another issue with the Docker image, I don’t believe it is responsible for the missing sendmail binary.