因为开放麒麟系统自带了比较新版的docker(反观deepin还在用老掉牙的版本)所以只需要安装docker-compose-v2即可

sudo apt install -y docker-compose-v2

将以下内容保存为docker-compose.yml(注意格式)

name: mysql
services:
  mysql5:
    image: mysql:5.7.44
    container_name: mysql5
    ports:
      - 3356:3306
    volumes:
      - /my/own/datadir/5:/var/lib/mysql
    environment:
      MYSQL_ROOT_PASSWORD: 123456
    restart: unless-stopped

  mysql8:
    image: mysql:8.4.3
    container_name: mysql8
    ports:
      - 3386:3306
    volumes:
      - /my/own/datadir/8:/var/lib/mysql
    environment:
      MYSQL_ROOT_PASSWORD: 123456
    restart: unless-stopped

  mysql9:
    image: mysql:9.1.0
    container_name: mysql9
    ports:
      - 3396:3306
    volumes:
      - /my/own/datadir/9:/var/lib/mysql
    environment:
      MYSQL_ROOT_PASSWORD: 123456
    restart: unless-stopped

终端中输入命令

sudo docker compose up -d

如果没有报错即表明启动成功
宿主机和同局域网下的设备都能访问