Skip to content

Docker :unable to run gitlab-ce:latest - What is my current version ?

Summary

My gitlab run in a Docker container I launch with this :

docker run --detach \
     --hostname ****** \
     --publish 443:443 --publish 80:80 --publish 2222:22 \
     --name gitlab \
     --restart always \
     --volume /srv/gitlab/config:/etc/gitlab \
     --volume /srv/gitlab/logs:/var/log/gitlab \
     --volume /srv/gitlab/data:/var/opt/gitlab \
     gitlab/gitlab-ce:latest

I used to stop, remove and run again some times in a year to get the last version of Gitlab.

Today, I can't start the container because of :

Error executing action `run` on resource 'bash[migrate gitlab-rails database]'

I suppose my version is too old the update the persistent data. But I can run successfully GitLab with latest version with the command :

docker run --detach \
     --hostname ****** \
     --publish 443:443 --publish 80:80 --publish 2222:22 \
     --name gitlab \
     --restart always \
     gitlab/gitlab-ce:latest

But I can't access to all my projects because there is no persistent data mounted.

Thanks for your help !

Steps to reproduce

docker run --detach \
     --hostname ****** \
     --publish 443:443 --publish 80:80 --publish 2222:22 \
     --name gitlab \
     --restart always \
     --volume /srv/gitlab/config:/etc/gitlab \
     --volume /srv/gitlab/logs:/var/log/gitlab \
     --volume /srv/gitlab/data:/var/opt/gitlab \
     gitlab/gitlab-ce:latest

What is the current bug behavior?

Unable to run the docker container.

What is the expected correct behavior?

A docker container running healthy with my persistent data from /srv/gitlab/

Relevant logs

Relevant logs
There was an error running gitlab-ctl reconfigure:

bash[migrate gitlab-rails database] (gitlab::database_migrations line 55) had an error: Mixlib::ShellOut::ShellCommandFailed: Expected process to exit with [0], but received '1' ---- Begin output of "bash" "/tmp/chef-script20200805-24-153xyq7" ---- STDOUT: 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/lib/tasks/gitlab/db.rake:48:in block (3 levels) in <top (required)>' /opt/gitlab/embedded/bin/bundle:23:in load' /opt/gitlab/embedded/bin/bundle:23:in `' Tasks: TOP => gitlab:db:configure (See full trace by running task with --trace) STDERR: ---- End output of "bash" "/tmp/chef-script20200805-24-153xyq7" ---- Ran "bash" "/tmp/chef-script20200805-24-153xyq7" returned 1

================================================================================
Error executing action `run` on resource 'bash[migrate gitlab-rails database]'
================================================================================

Mixlib::ShellOut::ShellCommandFailed
------------------------------------
Expected process to exit with [0], but received '1'
---- Begin output of "bash"  "/tmp/chef-script20200805-24-153xyq7" ----
STDOUT: 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/lib/tasks/gitlab/db.rake:48:in `block (3 levels) in <top (required)>'
/opt/gitlab/embedded/bin/bundle:23:in `load'
/opt/gitlab/embedded/bin/bundle:23:in `<main>'
Tasks: TOP => gitlab:db:configure
(See full trace by running task with --trace)
STDERR: 
---- End output of "bash"  "/tmp/chef-script20200805-24-153xyq7" ----
Ran "bash"  "/tmp/chef-script20200805-24-153xyq7" returned 1

Resource Declaration:
---------------------
# In /opt/gitlab/embedded/cookbooks/cache/cookbooks/gitlab/recipes/database_migrations.rb

 55: bash "migrate gitlab-rails database" do
 56:   code <<-EOH
 57:     set -e
 58:     log_file="#{node['gitlab']['gitlab-rails']['log_directory']}/gitlab-rails-db-migrate-$(date +%Y-%m-%d-%H-%M-%S).log"
 59:     umask 077
 60:     /opt/gitlab/bin/gitlab-rake gitlab:db:configure 2>& 1 | tee ${log_file}
 61:     STATUS=${PIPESTATUS[0]}
 62:     chown #{account_helper.gitlab_user}:#{account_helper.gitlab_group} ${log_file}
 63:     echo $STATUS > #{db_migrate_status_file}
 64:     exit $STATUS
 65:   EOH
 66:   environment env_variables unless env_variables.empty?
 67:   notifies :run, "execute[clear the gitlab-rails cache]", :immediately
 68:   dependent_services.each do |svc|
 69:     notifies :restart, svc, :immediately
 70:   end
 71:   not_if "(test -f #{db_migrate_status_file}) && (cat #{db_migrate_status_file} | grep -Fx 0)"
 72:   only_if { node['gitlab']['gitlab-rails']['auto_migrate'] }
 73: end

Compiled Resource:
------------------
# Declared in /opt/gitlab/embedded/cookbooks/cache/cookbooks/gitlab/recipes/database_migrations.rb:55:in `from_file'

bash("migrate gitlab-rails database") do
  action [:run]
  default_guard_interpreter :default
  command nil
  backup 5
  interpreter "bash"
  declared_type :bash
  cookbook_name "gitlab"
  recipe_name "database_migrations"
  code "    set -e\n    log_file=\"/var/log/gitlab/gitlab-rails/gitlab-rails-db-migrate-$(date +%Y-%m-%d-%H-%M-%S).log\"\n    umask 077\n    /opt/gitlab/bin/gitlab-rake gitlab:db:configure 2>& 1 | tee ${log_file}\n    STATUS=${PIPESTATUS[0]}\n    chown git:git ${log_file}\n    echo $STATUS > /var/opt/gitlab/gitlab-rails/upgrade-status/db-migrate-873248b1f0d3a7a5535771a3a1635803-8411f47246f\n    exit $STATUS\n"
  domain nil
  user nil
  not_if "(test -f /var/opt/gitlab/gitlab-rails/upgrade-status/db-migrate-873248b1f0d3a7a5535771a3a1635803-8411f47246f) && (cat /var/opt/gitlab/gitlab-rails/upgrade-status/db-migrate-873248b1f0d3a7a5535771a3a1635803-8411f47246f | grep -Fx 0)"
  only_if { #code block }
end

System Info:
------------
chef_version=14.14.29
platform=ubuntu
platform_version=16.04
ruby=ruby 2.6.6p146 (2020-03-31 revision 67876) [x86_64-linux]
program_name=/opt/gitlab/embedded/bin/chef-client
executable=/opt/gitlab/embedded/bin/chef-client

Running handlers: Running handlers complete Chef Client failed. 8 resources updated in 44 seconds

Details of package version

Provide the package version installation details
docker exec -it gitlab dpkg-query -l "gitlab*"
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name                                 Version                 Architecture            Description
+++-====================================-=======================-=======================-=============================================================================
un  gitlab                                                                   (no description available)
ii  gitlab-ce                            13.1.3-ce.0             amd64                   GitLab Community Edition (including NGINX, Postgres, Redis)
un  gitlab-ee                                                                (no description available)

Environment details

  • Operating System:
cat /etc/os-release
NAME="VMware Photon OS"
VERSION="2.0"
ID=photon
VERSION_ID=2.0
PRETTY_NAME="VMware Photon OS/Linux"
ANSI_COLOR="1;34"
HOME_URL="https://vmware.github.io/photon/"
BUG_REPORT_URL="https://github.com/vmware/photon/issues"
Kernel: Linux 4.9.101-1.ph2-esx
Architecture: x86-64
  • Installation Target, remove incorrect values:

    • VM: Photon OS
  • Installation Type, remove incorrect values:

    • Upgrade from version **unknown** (could be the problem)
  • Is there any other software running on the machine: none

  • Is this a single or multiple node installation? single

  • Resources

    • CPU:
cat /proc/cpuinfo
processor	: 0
vendor_id	: GenuineIntel
cpu family	: 6
model		: 58
model name	: Intel(R) Xeon(R) CPU E5-2440 v2 @ 1.90GHz
stepping	: 0
microcode	: 0x42e
cpu MHz		: 1900.000
cache size	: 20480 KB
physical id	: 0
siblings	: 1
core id		: 0
cpu cores	: 1
apicid		: 0
initial apicid	: 0
fpu		: yes
fpu_exception	: yes
cpuid level	: 13
wp		: yes
flags		: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts mmx fxsr sse sse2 ss syscall nx rdtscp lm constant_tsc arch_perfmon pebs bts nopl xtopology tsc_reliable nonstop_tsc eagerfpu pni pclmulqdq ssse3 cx16 pcid sse4_1 sse4_2 x2apic popcnt tsc_deadline_timer aes xsave avx f16c rdrand hypervisor lahf_lm ibrs ibpb stibp kaiser fsgsbase tsc_adjust smep arat arch_capabilities
bugs		: cpu_meltdown spectre_v1 spectre_v2 spec_store_bypass
bogomips	: 3800.00
clflush size	: 64
cache_alignment	: 64
address sizes	: 42 bits physical, 48 bits virtual
power management:

Configuration details

Provide the relevant sections of /etc/gitlab/gitlab.rb

Everything is commented in docker exec -it gitlab cat /etc/gitlab/gitlab.rb

Edited by Jason Plum