Docker-compose: Database is uninitialized

后端 未结 5 1351
轻奢々
轻奢々 2021-02-18 17:02

I have a problem with docker-compose and mysql:

docker-compose.yml

version: \'2\' 
  services:
   db:
    image: mysql
    volumes:
      - \"./sito/db/:         


        
5条回答
  •  星月不相逢
    2021-02-18 17:45

    According the documentation, instead of MYSQL_ROOT_PASSWORD: you have to use - and = and also you should use a 'password' The result it will be:

    - MYSQL_ROOT_PASSWORD=some_password

    In your example:

    version: '2' 
      services:
       db:
        image: mysql
        volumes:
          - "./sito/db/:/var/lib/mysql"
        ports:
          - "3306:3306"
        restart: always
        environment:
          - MYSQL_ROOT_PASSWORD=some_password
    

提交回复
热议问题