docker-compose.yml文件中的特定数据库详细信息?

时间:2018-05-14 03:36:24

标签: docker-compose prisma

我正在使用的服务为您提供了创建docker-compose文件的命令。然后,您可以运行docker-compose up并选择创建新数据库。

version: '3'
services:
  prisma:
    image: prismagraphql/prisma:1.8
    restart: always
    ports:
    - "4466:4466"
    environment:
      PRISMA_CONFIG: |
        port: 4466
        # uncomment the next line and provide the env var PRISMA_MANAGEMENT_API_SECRET=my-secret to activate cluster security
        # managementApiSecret: my-secret
        databases:
          default:
            connector: mysql
            host: mysql
            port: 3306
            user: root
            password: prisma
            migrations: true
  mysql:
    image: mysql:5.7
    restart: always
    environment:
      MYSQL_ROOT_PASSWORD: prisma
    volumes:
      - mysql:/var/lib/mysql
volumes:
  mysql:

这有效但现在我需要用新数据库设置第二个项目。即使我在运行项目时选择了设置新数据库的选项,我也可以看到它连接到我的旧项目:

 prisma init
? Set up a new Prisma server or deploy to an existing server? Create new database
? What kind of database do you want to deploy to? MySQL

Created 3 new files:

  prisma.yml           Prisma service definition
  datamodel.graphql    GraphQL SDL-based datamodel (foundation for database)
  docker-compose.yml   Docker configuration file
Next steps:

  1. Start your Prisma server: docker-compose up -d
  2. Deploy your Prisma service: prisma deploy
  3. Read more about Prisma server:

我的docker-compose.yml中有什么东西错了吗?我相信default是数据库名称,所以我尝试了以下但是同样的事情发生了:

        databases:
          default2:
            connector: mysql

0 个答案:

没有答案