skip to Main Content

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


  1. Chosen as BEST ANSWER

    Here is the revised copy:

    version: '3.4'
    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
    

    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'


  2. Your docker-compose.yml file is missing a version: line. Until very recently, this caused Docker Compose to interpret this as the original "version 1" Compose format, which doesn’t have a top-level services: key and doesn’t support Docker networks. The much newer Compose Specification claims that a version: 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 the docker binary) it’s required. The most recent Compose file versions supported by the standalone Python docker-compose tool are 3.8 and 2.4 (you need the 2.x version for some resource-related constraints in non-Swarm installations).

    # Add at the very beginning
    version: '3.8'
    
    Login or Signup to reply.
  3. for me work try different version. In my case work

    version: ‘2.2’

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search