Syntax error in example docker compose
Problem to solve
A few docker-compose.yml
examples are provided the Install GitLab using Docker Compose documentation. When following the instructions, I copied one of the examples and wrote it to a docker-compose.yml
file. However, using docker-compose
commands with this file failed:
$ docker-compose convert
(root) Additional property web is not allowed
Further details
$ cat <<EOF >docker-compose.yml
web:
image: 'gitlab/gitlab-ee:latest'
restart: always
hostname: 'gitl ab.example.com'
environment:
GITLAB_OMNIBUS_CONFIG: |
external_url 'https://gitlab.example.com'
# Add any other gitlab.rb configuration here, each on its own line
ports:
- '80:80'
- '443:443'
- '22:22'
volumes:
- '$GITLAB_HOME/config:/etc/gitlab'
- '$GITLAB_HOME/logs:/var/log/gitlab'
- '$GITLAB_HOME/data:/var/opt/gitlab'
shm_size: '256m'
EOF
$ docker-compose convert
(root) Additional property web is not allowed
Proposal
Include version: '3.6'
, and nest web
under services
:
version: '3.6'
services:
web:
image: 'gitlab/gitlab-ee:latest'
restart: always
hostname: 'gitlab.example.com'
environment:
GITLAB_OMNIBUS_CONFIG: |
external_url 'https://gitlab.example.com'
# Add any other gitlab.rb configuration here, each on its own line
ports:
- '80:80'
- '443:443'
- '22:22'
volumes:
- '$GITLAB_HOME/config:/etc/gitlab'
- '$GITLAB_HOME/logs:/var/log/gitlab'
- '$GITLAB_HOME/data:/var/opt/gitlab'
shm_size: '256m'