简体   繁体   English

这个 docker-compose.yml 文件有什么问题

[英]What is wrong with this docker-compose.yml file

I am trying to install gitlab ce with docker compose file.我正在尝试使用 docker 撰写文件安装 gitlab ce。 I have had lots of permissions problem with bind volumes.绑定卷有很多权限问题。 I would like to try names volumes.我想尝试命名卷。 Following is my file.以下是我的文件。

web:
  image: 'gitlab/gitlab-ce:latest'
  container_name: 'gitlab'
  restart: always
  hostname: 'gitlab.xxxx.com'
  environment:
    GITLAB_OMNIBUS_CONFIG: |
      external_url 'https://gitlab.xxxx.com'
  ports:
    - '10080:80'
    - '10443:443'
    - '10022:22'
  volumes:
    - gitlab_config:/etc/gitlab
    - gitlab_log:/var/log/gitlab
    - gitlab_data:/var/opt/gitlab
volumes: 
  gitlab_config:
    external: true
  gitlab_log: 
    external: true
  gitlab_data:
    external: true

I receive following error:我收到以下错误:

docker-compose up -d
ERROR: The Compose file './docker-compose.yml' is invalid because:
Unsupported config option for volumes: 'gitlab_data'

Volumes have been created previously with docker volume create command之前已使用docker volume create命令创建卷

UPDATE: Based the solution by Ganesh Satpute, I submit the working/tested file below.更新:基于 Ganesh Satpute 的解决方案,我在下面提交了工作/测试文件。 Someone may need it since gitlab page does not provide it.有人可能需要它,因为 gitlab 页面没有提供它。 Thank you "Ganesh".谢谢“甘尼什”。

---
version: "2.4"
services:
  web:
    image: 'gitlab/gitlab-ce:latest'
    container_name: 'gitlab'
    restart: always
    hostname: 'gitlab.xxxx.com'
    environment:
       GITLAB_OMNIBUS_CONFIG: 'https://gitlab.xxxx.com'
    ports:
      - '10080:80'
      - '10443:443'
      - '10022:22'
    volumes:
      - gitlab_config:/etc/gitlab
      - gitlab_log:/var/log/gitlab
      - gitlab_data:/var/opt/gitlab
volumes: 
  gitlab_config:
    external: true
  gitlab_log:
    external: true
  gitlab_data:
    external: true

I modified your docker-compose.yml with this我用这个修改了你的docker-compose.yml

version: "2.4"
services:
  web:
    image: 'gitlab/gitlab-ce:latest'
    container_name: 'gitlab'
    restart: always
    hostname: 'gitlab.xxxx.com'
    environment:
      GITLAB_OMNIBUS_CONFIG: 'https://gitlab.xxxx.com'
    ports:
    - '10080:80'
    - '10443:443'
    - '10022:22'
    volumes:
    - gitlab_config:/etc/gitlab
    - gitlab_log:/var/log/gitlab
    - gitlab_data:/var/opt/gitlab
volumes:
  gitlab_config:
    external: true
  gitlab_log:
    external: true
  gitlab_data:
    external: true

You can always check by running docker-compose config to check if the config file is valid or not.您始终可以通过运行 docker-compose 配置来检查配置文件是否有效。 If not google the errors and also check few examples online.如果不是谷歌错误,也可以在线查看一些示例。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM