Docker Redis: Version "6.0.8" in ".\docker-compose.yml" is invalid

491 Views Asked by At

I am using Docker desktop for Windows - community edition, version 2.4.0.0 (2020-09-28) follow tutorial https://www.youtube.com/watch?v=XrFeRwJjWHI ,

File docker-compose.yml

version: "6.0.8"

services:
  redis:
    image: redis
    volumes:
      - ./data:/data
    ports:
      - 6379:6379

I run command

Microsoft Windows [Version 10.0.19041.508]
(c) 2020 Microsoft Corporation. All rights reserved.

D:\docker>docker-compose up
ERROR: Version "6.0.8" in ".\docker-compose.yml" is invalid.

D:\docker>

but error enter image description here

I see at here https://hub.docker.com/_/redis has version 6.0.8 . How to fix it?

2

There are 2 best solutions below

0
On BEST ANSWER

Version tag is used for specifying docker-compose reference version. You need to choose between existing versions. See https://docs.docker.com/compose/compose-file/

If you want to set redis version you need to use image tag

version: "3.8"

services:
  redis:
    image: redis:6.0.8
    volumes:
      - ./data:/data
    ports:
      - 6379:6379
0
On

It is confusing between version of docker-compose and redis. Use value 3.0.8 .

Reference: https://docs.docker.com/compose/compose-file/