docker 容器获取主机权限

添加以下配置:

1
privileged: true

gitlab docker-compose 文件如下:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
gitlab:
image: 'gitlab/gitlab-ce:11.0.1-ce.0'
restart: always
container_name: gitlab
privileged: true
environment:
GITLAB_OMNIBUS_CONFIG: |
# Add any other gitlab.rb configuration here, each on its own line
ports:
- '3080:80'
- '3443:443'
- '3022:22'
volumes:
- '/etc/gitlab:/etc/gitlab'
- '/var/log/gitlab:/var/log/gitlab'
- '/data/gitlab/:/var/opt/gitlab'