version: "3" services: redis: image: redis container_name: redis-backset # 容器名称 restart: always ports: - "26379:26379" expose: - "26379" command: redis-server --requirepass "cr654654." --port 26379 mysql: image: mysql:5.7.38 container_name: mysql-backset # 容器名称 restart: always ports: - "3307:3307" expose: - "3307" environment: MYSQL_DATABASE: "backset" MYSQL_USER: "backset" MYSQL_PASSWORD: "backset" MYSQL_ROOT_PASSWORD: "root" MYSQL_ROOT_HOST: "%" MYSQL_TCP_PORT: 3307 web: build: . restart: always container_name: backset-server # 容器名称 ports: - "7001:7001" links: - mysql:mysql - redis:redis depends_on: - mysql - redis