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"