1

i am trying to deploy a stack to my docker swarm but it does not work. i call the command

sudo docker stack deploy -c docker-compose.yml server-test 

but it gives me the error

unsupported Compose file version: 2 

but when i run docker-compose up, it works fine. i then check the docker-compose --version which gives me:

docker-compose version 1.21.2, build a133471 

this is the latest version as of writing this. i'm fairly new to docker so any guidance on this is appreciated.

my docker-compose.yml file is as follows:

version: '2' services: caddy: build: . ports: - "80:80" - "443:443" portainer: image: portainer/portainer:latest ports: - "9000:9000" volumes: - "/var/run/docker.sock:/var/run/docker.sock" 
0

1 Answer 1

1

The error refers to version: '2' in the first line of docker-compose.yml. You need to change syntax to at least version: '3.0' then docker stack will work.

There is upgrade guide for docker-compose.yml.

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.