Postgres won't start on Docker

My server was shut down because one of the drives failed. I am trying to migrate the GitLab content to another server.

So I copied the data, config and logs directories and started a gitlab-ce container with the command update-permissions first. Then I had to run # chmod -R 2770 /data/git-data/repositories to fix other permission errors. Now I’m facing with this when I launch the container:

* postgresql_user[gitlab] action create
    * execute[create gitlab postgresql user] action run
      [execute] psql: 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"?
      [execute] psql: 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"?
      [execute] psql: 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"?
      [execute] psql: 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"?
      [execute] psql: 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"?
      [execute] psql: 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"?
      [execute] psql: 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"?
      [execute] psql: 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"?
      [execute] psql: 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"?
      [execute] psql: 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"?
      [execute] psql: 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"?
      [execute] psql: 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"?
      [execute] psql: 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"?
      [execute] psql: 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"?
      [execute] psql: 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"?
      [execute] psql: 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"?
      [execute] psql: 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"?
      [execute] psql: server closed the connection unexpectedly
                        This probably means the server terminated abnormally
                        before or while processing the request.
      [execute] psql: 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"?
      [execute] psql: 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"?
      [execute] psql: 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"?

      ================================================================================
      Error executing action `run` on resource 'execute[create gitlab postgresql user]'
      ================================================================================

      Mixlib::ShellOut::ShellCommandFailed
      ------------------------------------
      Expected process to exit with [0], but received '2'
      ---- Begin output of /opt/gitlab/bin/gitlab-psql -d template1 -c "CREATE USER \"gitlab\"" ----
      STDOUT:
      STDERR: psql: 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"?
      ---- End output of /opt/gitlab/bin/gitlab-psql -d template1 -c "CREATE USER \"gitlab\"" ----
      Ran /opt/gitlab/bin/gitlab-psql -d template1 -c "CREATE USER \"gitlab\"" returned 2

      Resource Declaration:
      ---------------------
      # In /opt/gitlab/embedded/cookbooks/cache/cookbooks/postgresql/resources/user.rb

       11:   execute "create #{new_resource.username} postgresql user" do
       12:     command %(/opt/gitlab/bin/#{new_resource.helper.service_cmd} -d template1 -c "#{query}")
       13:     user account_helper.postgresql_user
       14:     # Added retries to give the service time to start on slower systems
       15:     retries 20
       16:     not_if { new_resource.helper.is_offline_or_readonly? || new_resource.helper.user_exists?(new_resource.username) }
       17:   end
       18:

      Compiled Resource:
      ------------------
      # Declared in /opt/gitlab/embedded/cookbooks/cache/cookbooks/postgresql/resources/user.rb:11:in `block in class_from_file'

      execute("create gitlab postgresql user") do
        action [:run]
        default_guard_interpreter :execute
        command "/opt/gitlab/bin/gitlab-psql -d template1 -c \"CREATE USER \\\"gitlab\\\"\""
        backup 5
        returns 0
        user "gitlab-psql"
        declared_type :execute
        cookbook_name "postgresql"
        domain nil
        retries 20
        not_if { #code block }
      end

      System Info:
      ------------
      chef_version=13.6.4
      platform=ubuntu
      platform_version=16.04
      ruby=ruby 2.5.3p105 (2018-10-18 revision 65156) [x86_64-linux]
      program_name=/opt/gitlab/embedded/bin/chef-client
      executable=/opt/gitlab/embedded/bin/chef-client


    ================================================================================
    Error executing action `create` on resource 'postgresql_user[gitlab]'
    ================================================================================

    Mixlib::ShellOut::ShellCommandFailed
    ------------------------------------
    execute[create gitlab postgresql user] (/opt/gitlab/embedded/cookbooks/cache/cookbooks/postgresql/resources/user.rb line 11) had an error: Mixlib::ShellOut::ShellCommandFailed: Expected process to exit with [0], but received '2'
    ---- Begin output of /opt/gitlab/bin/gitlab-psql -d template1 -c "CREATE USER \"gitlab\"" ----
    STDOUT:
    STDERR: psql: 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"?
    ---- End output of /opt/gitlab/bin/gitlab-psql -d template1 -c "CREATE USER \"gitlab\"" ----
    Ran /opt/gitlab/bin/gitlab-psql -d template1 -c "CREATE USER \"gitlab\"" returned 2

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

    196:   postgresql_user gitlab_sql_user do
    197:     password "md5#{gitlab_sql_user_password}" unless gitlab_sql_user_password.nil?
    198:     action :create
    199:     not_if { pg_helper.is_slave? }
    200:   end
    201:

    Compiled Resource:
    ------------------
    # Declared in /opt/gitlab/embedded/cookbooks/cache/cookbooks/postgresql/recipes/enable.rb:196:in `from_file'

    postgresql_user("gitlab") do
      action [:create]
      default_guard_interpreter :default
      declared_type :postgresql_user
      cookbook_name "postgresql"
      recipe_name "enable"
      not_if { #code block }
    end

    System Info:
    ------------
    chef_version=13.6.4
    platform=ubuntu
    platform_version=16.04
    ruby=ruby 2.5.3p105 (2018-10-18 revision 65156) [x86_64-linux]
    program_name=/opt/gitlab/embedded/bin/chef-client
    executable=/opt/gitlab/embedded/bin/chef-client

Recipe: gitlab::gitlab-rails
  * execute[clear the gitlab-rails cache] action run
    - execute /opt/gitlab/bin/gitlab-rake cache:clear
Recipe: redis::enable
  * ruby_block[restart redis svlogd configuration] action create
    - execute the ruby block restart redis svlogd configuration
Recipe: postgresql::enable
  * ruby_block[restart postgresql svlogd configuration] action create
    - execute the ruby block restart postgresql svlogd configuration

Running handlers:
There was an error running gitlab-ctl reconfigure:

postgresql_user[gitlab] (postgresql::enable line 196) had an error: Mixlib::ShellOut::ShellCommandFailed: execute[create gitlab postgresql user] (/opt/gitlab/embedded/cookbooks/cache/cookbooks/postgresql/resources/user.rb line 11) had an error: Mixlib::ShellOut::ShellCommandFailed: Expected process to exit with [0], but received '2'
---- Begin output of /opt/gitlab/bin/gitlab-psql -d template1 -c "CREATE USER \"gitlab\"" ----
STDOUT:
STDERR: psql: 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"?
---- End output of /opt/gitlab/bin/gitlab-psql -d template1 -c "CREATE USER \"gitlab\"" ----
Ran /opt/gitlab/bin/gitlab-psql -d template1 -c "CREATE USER \"gitlab\"" returned 2

Running handlers complete
Chef Client failed. 89 resources updated in 01 minutes 15 seconds

How do I fix it?