Docker-compose.yml: `version` is obsolete

I just updated docker desktop and docker-compose to version v2.27.0-desktop.2
and i cant use version: 3.8 in the docker file anymore

version: '3.8'

services:
  rabbitmq:
    container_name: rabbitmq
    image: "rabbitmq:3-management"
    hostname: "rabbit"
    environment:
      RABBITMQ_DEFAULT_USER: "rabbitmq"
      RABBITMQ_DEFAULT_PASS: "rabbitmq"
    ports:
      - "15700:15672"
      - "5673:5672"
    labels:
      NAME: "rabbitmq"
    healthcheck:
      test: ["CMD", "rabbitmqctl", "status"]
      interval: 10s
      timeout: 5s
      retries: 3
    networks: 
      - psi_cron
    restart: always
    volumes: 
      - ./rabbitmq.conf:/etc/rabbitmq/rabbitmq.confe

HI, i think you dont need to define version number in docker compose file anymore. just start with services: and see if you still get the warning?

2 Likes

Indeed… Just remove the first line of your file, it’s now deprecated.

Technically you can still define it… But you will get the warning you observed, and it won’t be used, as docker compose v2 (=the cli plugin) will always use the latest version of the compose file schema.

Though, I am more curious why this post is in the “Docker Hub” category. Can you share your though on why this topic belongs in this category?

Thanks guys,
i just omitted the version and it worked fine for me

1 Like