I am trying to get a couple of containers up and running, however I am running into some issues. I run this command:
docker-compose up -d –build itvdflab
and get this error
The Compose file ‘./docker-compose.yaml’ is invalid because:
Unsupported config option for services: ‘itvdelab’
Unsupported config option for networks: ‘itvdelabnw’
Here is the yaml file.
services:
itvdelab:
image: itversity/itvdelab
hostname: itvdelab
ports:
- "8888:8888"
volumes:
- "./itversity-material:/home/itversity/itversity-material"
- "./data:/data"
environment:
SHELL: /bin/bash
networks:
- itvdelabnw
depends_on:
- "cluster_util_db"
cluster_util_db:
image: postgres:13
ports:
- "6432:5432"
volumes:
- ./cluster_util_db_scripts:/docker-entrypoint-initdb.d
networks:
- itvdelabnw
environment:
POSTGRES_PASSWORD: itversity
itvdflab:
build:
context: .
dockerfile: images/pythonsql/Dockerfile
hostname: itvdflab
ports:
- "8888:8888"
volumes:
- "./itversity-material:/home/itversity/itversity-material"
- "./data:/data"
environment:
SHELL: /bin/bash
networks:
- itvdelabnw
depends_on:
- "pg.itversity.com"
pg.itversity.com:
image: postgres:13
ports:
- "5432:5432"
networks:
- itvdelabnw
environment:
POSTGRES_PASSWORD: itversity
networks:
itvdelabnw:
name: itvdelabnw
What changes do I need to make to get this working?
3
Answers
Here is the revised copy:
and now I get the following error
ERROR: The Compose file './docker-compose.yaml' is invalid because: services.pg.itversity.com.networks.itvdelabnw contains unsupported option: 'name'
Your
docker-compose.yml
file is missing aversion:
line. Until very recently, this caused Docker Compose to interpret this as the original "version 1" Compose format, which doesn’t have a top-levelservices:
key and doesn’t support Docker networks. The much newer Compose Specification claims that aversion:
key is optional, but in practice if you can’t be guaranteed to use a very new version of Compose (built as a plugin to thedocker
binary) it’s required. The most recent Compose file versions supported by the standalone Pythondocker-compose
tool are 3.8 and 2.4 (you need the 2.x version for some resource-related constraints in non-Swarm installations).for me work try different version. In my case work
version: ‘2.2’