2

下面的 docker-compose.yml 文件应该使用 docker 的 macvlan 在我的本地网络上调出 gitlab 的 gitlab-ce。但是,我无法在浏览器中查看 gitlab-ce 或 ping 分配的 Ip。在检查了生成的容器后,我看到虽然容器确实在我的网络上分配了一个 IP 地址,

"Gateway": "10.0.1.1",
"IPAddress": "10.0.1.2"

,它不分配 HostIp。

"NetworkMode": "config_frontend",
"PortBindings": {
    "22/tcp": [
        {
            "HostIp": "",
            "HostPort": "22"
        }
    ],
    "443/tcp": [
        {
            "HostIp": "",
            "HostPort": "443"
        }
    ],
    "80/tcp": [
        {
            "HostIp": "",
            "HostPort": "80"
        }
    ]
},

如何更新我的 docker-compose.yml 文件?

version: '3'                                                                                                                                                                                                                                 
 services:                                                                                                                                                                                                                                    
  gitlab-server:                                                                                                                                                                                                                             
    image: 'gitlab/gitlab-ce:latest'                                                                                                                                                                                                         
    hostname: 'gitlab.example.com'                                                                                                                                                                                                           
    environment:
      GITLAB_OMNIBUS_CONFIG: |
        external_url 'https://gitlab.example.com'
    ports:
      - '80:80'
      - '443:443'
      - '22:22'
    networks:
      - frontend
    volumes:
      - './data/gitlab/config:/etc/gitlab'
      - './data/gitlab/logs:/var/log/gitlab'
      - './data/gitlab/data:/var/opt/gitlab'
    restart: always
networks:
  frontend:
    driver: macvlan
    driver_opts:
      parent: eno1.10
    ipam:
      config:
        - subnet: 10.0.1.0/24
4

0 回答 0