Skip to content

Geo replicate-geo-database fails under Docker due to sudo

ZD: https://gitlab.zendesk.com/agent/tickets/78550

sudo is not available in a Docker container:

root@5e6543e58b18:~# gitlab-ctl replicate-geo-database --host=10.235.2.7 --no-wait --force

--------------------------------------------------------------- 
WARNING: Make sure this script is run from the secondary server 
---------------------------------------------------------------

This script will disable your local PostgreSQL database, and start 
a backup/restore from the primary node at '10.235.2.7'

* Stopping PostgreSQL and all GitLab services 
* Backing up postgresql.conf 
/opt/gitlab/embedded/lib/ruby/gems/2.3.0/gems/mixlib-shellout-2.2.7/lib/mixlib/shellout/unix.rb:338:in `exec': No such file or directory - sudo (Errno::ENOENT) 
from /opt/gitlab/embedded/lib/ruby/gems/2.3.0/gems/mixlib-shellout-2.2.7/lib/mixlib/shellout/unix.rb:338:in `block in fork_subprocess' 
from /opt/gitlab/embedded/lib/ruby/gems/2.3.0/gems/mixlib-shellout-2.2.7/lib/mixlib/shellout/unix.rb:316:in `fork' 
from /opt/gitlab/embedded/lib/ruby/gems/2.3.0/gems/mixlib-shellout-2.2.7/lib/mixlib/shellout/unix.rb:316:in `fork_subprocess' 
from /opt/gitlab/embedded/lib/ruby/gems/2.3.0/gems/mixlib-shellout-2.2.7/lib/mixlib/shellout/unix.rb:93:in `run_command' 
from /opt/gitlab/embedded/lib/ruby/gems/2.3.0/gems/mixlib-shellout-2.2.7/lib/mixlib/shellout.rb:259:in `run_command' 
from /opt/gitlab/embedded/service/omnibus-ctl/lib/gitlab_ctl/util.rb:24:in `run_command' 
from (eval):163:in `run_command' 
from (eval):51:in `execute' 
from (eval):215:in `block in load_file' 
from /opt/gitlab/embedded/lib/ruby/gems/2.3.0/gems/omnibus-ctl-0.3.6/lib/omnibus-ctl.rb:181:in `block in add_command_under_category' 
from /opt/gitlab/embedded/lib/ruby/gems/2.3.0/gems/omnibus-ctl-0.3.6/lib/omnibus-ctl.rb:575:in `run' 
from /opt/gitlab/embedded/lib/ruby/gems/2.3.0/gems/omnibus-ctl-0.3.6/bin/omnibus-ctl:31:in `<top (required)>' 
from /opt/gitlab/embedded/bin/omnibus-ctl:22:in `load' 
from /opt/gitlab/embedded/bin/omnibus-ctl:22:in `<main>'