Restart GitLab with docker get permission denied

I host a gitlab-ce with docker image and start with docker compose.
Here is my docker compose file

version: "3.6"
services:
  web:
    image: 'gitlab/gitlab-ce'
    container_name: 'gitlab-master'
    restart: always
    hostname: 'url'
    environment:
      GITLAB_OMNIBUS_CONFIG: |
        external_url 'http://url:9090'
        gitlab_rails['gitlab_shell_ssh_port'] = 2224
    networks:
      - gitlab-network
    ports:
      - '80:80'
      - '443:443'
      - '9090:9090'
      - '2224:22'
    volumes:
      - '/srv/gitlab/config:/etc/gitlab'
      - '/srv/gitlab/logs:/var/log/gitlab'
      - '/srv/gitlab/data:/var/opt/gitlab'
networks:
  gitlab-network:
    name: gitlab-network

I pack my config folders, logs and data and transfer to another server. When I start a new gitlab server and mount this folders. I got the permission denied error. I use chmod -R 777 /srv/gitlab/*. It still error. How could I fix this?

Yes you can. See the output of docker logs and it will tell you need to run a command to fix the permissions

1 Like

Hi Rukeith, I would recommend that you tar the entire directories on the old server which keeps the U- and GIDs of all files etc.

Have a lock to the file system on the old server it will look like below. I had the same problem.

1 Like