Sequel Pro with Mysql in Docker

后端 未结 5 1047
挽巷
挽巷 2021-02-05 07:02

I build 2 docker container with docker-compose. I use Docker on Mac, no boot2docker.

version: \'2\'
    services:
        drupal-web:
            image: drupal:         


        
5条回答
  •  一向
    一向 (楼主)
    2021-02-05 07:07

    Should look a bit more like this:

    version: '2'
    services:
        mysql-server:
            image: mysql
            environment:
                MYSQL_ROOT_PASSWORD: root
                MYSQL_DATABASE: drupal
                MYSQL_USER: drupal
                MYSQL_PASSWORD: drupal
    
        drupal-web:
            image: drupal:latest
            ports:
                - "8080:80"
            depends_on:
                - mysql-server
            links:
                - mysql-server:mysql-server
            environment:
                MYSQL_DATABASE: drupal
                MYSQL_USER: drupal
                MYSQL_PASSWORD: drupal
    

    (Im not sure if defining the environment variables on a global level work, maybe someone who knows can correct my answer here and simplify it)

    As you can see, you have 2 services, mysql-server and drupal-web. Drupal-web links your database service. Both services have their own environment variables.

提交回复
热议问题