Je veux exécuter mysql sur Windows en utilisant le conteneur docker lorsque j'essaie d'utiliser la commande docker-compose up sur le fichier docker-compose ce résultat.
> D:\dockerfiles>docker-compose up
db_1 | Initializing database
db_1 | 2018-10-08T09:00:29.024081Z 0 [Warning] Changed limits: max_open_files: 1024 (requested 5000)
db_1 | 2018-10-08T09:00:29.024224Z 0 [Warning] Changed limits: table_open_cache: 431 (requested 2000)
db_1 | 2018-10-08T09:00:29.024512Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
db_1 | 2018-10-08T09:00:29.028590Z 0 [ERROR] --initialize specified but the data directory has files in it. Aborting.
db_1 | 2018-10-08T09:00:29.028673Z 0 [ERROR] Aborting
db_1 |
dockerfiles_db_1 exited with code 1
et ceci mon docker-compose.yml
version: '3.7'
services:
db:
image: mysql:5.7
restart: always
environment:
MYSQL_ROOT_PASSWORD: pass
MYSQL_DATABASE: star
MYSQL_USER: user
MYSQL_PASSWORD: pass
mise à jour du fichier de composition docker
version: '3.7'
services:
mysqldb:
image: mysql:5.7
container_name: mysql_con1
command: --default-authentication-plugin=mysql_native_password
command: --disable-partition-engine-check
restart: always
environment:
MYSQL_ROOT_PASSWORD: pass
MYSQL_DATABASE: star
MYSQL_USER: user
MYSQL_PASSWORD: pass
volumes:
- "./:/var/lib/mysql"
networks:
- samplenet
networks:
samplenet:
driver: nat
J'ai le même comportement définissant restart = always, si je le supprime, tout s'est bien passé, et plus tard j'exécute la commande
docker update --restart=always {{ID OF CONTAINER}}
Ce qui le fait redémarrer toujours. J'espère que cela vous aidera.