Error 500 after upgrade - Apparently related to hooks directories

Our GitLab installation is Docker Omnibus on an Ubuntu server. Today I have upgraded it to the last Gitlab version, but when I try to access Gitlab, I get error 500.

I have run a check:

$ sudo docker exec -it gitlablast gitlab-rake gitlab:check SANITIZE=true
Checking GitLab Shell ...

GitLab Shell version >= 5.0.4 ? ... OK (5.0.4)
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: ... rake aborted!
PG::ConnectionBad: could not connect to server: No such file or directory
Is the server running locally and accepting
connections on Unix domain socket "/var/opt/gitlab/postgresql/.s.PGSQL.5432"?
/opt/gitlab/embedded/service/gitlab-rails/app/models/project.rb:257:in `block in <class:Project>'
/opt/gitlab/embedded/service/gitlab-rails/lib/tasks/gitlab/check.rake:470:in `check_repos_hooks_directory_is_link'
/opt/gitlab/embedded/service/gitlab-rails/lib/tasks/gitlab/check.rake:346:in `block (3 levels) in <top (required)>'
/opt/gitlab/embedded/bin/bundle:22:in `load'
/opt/gitlab/embedded/bin/bundle:22:in `<main>'
Tasks: TOP => gitlab:check => gitlab:gitlab_shell:check
(See full trace by running task with --trace)

I have checked the hooks directories, and they all are links to the same non-existent directory /opt/gitlab/embedded/service/gitlab-shell/hooks. E.g.:

lrwxrwxrwx 1 998 mygroup 47 Nov 14 2016 /srv/gitlab/data/git-data/repositories/root/test.wiki.git/hooks -> /opt/gitlab/embedded/service/gitlab-shell/hooks

Note that there is no /opt/gitlab on our server!