Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to migrate from docker-compose v2 to docker-compose v3 with swarm?

My current docker-compose.yml is

version: "2"

services:
  nginx:
    restart: always
    image: nginx:latest
    ports:
      - 80:80
      - 443:443
    volumes:
      - ./misc/nginx.conf:/etc/nginx/conf.d/default.conf
      - /static:/static
    depends_on:
      - web

  db:
    restart: always
    image: postgres
    env_file:
      - ./.env
    volumes:
      - pgdata:/var/lib/postgresql/data
    ports:
      - "5432:5432"

  web:
    restart: always
    build:
      context: .
    command: bash -c "python /code/manage.py collectstatic --noinput && python /code/manage.py migrate && /code/run_gunicorn.sh"
    volumes:
      - /static:/data/web/static
      - /media:/data/web/media
      - .:/code
    env_file:
      - ./.env
    depends_on:
      - db


volumes:
  pgdata:
    external:
      name: orderstore

How to update it to the latest docker-compose revision (3.4) with swarm mode support? At least now it's saying that build key is not supported.

My very goal is to deploy it to AWS EC2/ECS. If it's possible - please describe me how to properly deploy it to AWS.

Thanks

like image 955
Vassily Avatar asked Sep 17 '25 05:09

Vassily


1 Answers

I am not aware of an automatic way of migrating compose file. The changes are documented in Compose file versions and upgrading. You need to do the migration manually.

like image 78
yamenk Avatar answered Sep 19 '25 21:09

yamenk