Right way to update Docker 2.16.3 to 3.x

What’s the current way to properly upgrade from 2.x to 3.x if you were using the official Docker composer:latest version?

I am not sure if I should spin up a new mautic:v3 container and try to connect it to our current 2.x database for it to auto upgrade? Or maybe try to upgrade from inside the 2.x container to then build a new v3 container and use the upgraded database?

In any case, there is very little mautic-docker-related talk out there and I thought we could make this post the official one for all the docker folk out there that are having a bad time with the update/upgrade process

This is the compose version I’ve been using for the last few months:

version: '2'

services:

  mauticdb:
    restart: always
    image: percona/percona-server:5.7
    container_name: mauticdb
    volumes:
      - mysql_data:/var/lib/mysql
    environment:
      - MYSQL_ROOT_PASSWORD=mysecret
    command:
      --character-set-server=utf8mb4 --collation-server=utf8mb4_general_ci
    networks:
      - mautic-net

  mautic:
    restart: always
    image: mautic/mautic:latest
    container_name: mautic
    links:
      - mauticdb:mysql
    depends_on:
      - mauticdb
    ports:
      - 31279:80
    volumes:
      - mautic_data:/var/www/html
    environment:
      - MAUTIC_DB_HOST=mauticdb
      - MYSQL_PORT_3306_TCP=3306
      - MAUTIC_DB_USER=root
      - MAUTIC_DB_PASSWORD=mysecret
      - MAUTIC_DB_NAME=mautic
      - MAUTIC_RUN_CRON_JOBS=true
    networks:
      - mautic-net

volumes:
  mysql_data:
    driver: local
  mautic_data:
    driver: local
networks:
  mautic-net:
    driver: bridge

Try this in the Docker Forums as it’s more a Docker related question than Mautic Specific.