M
M
microf2020-05-06 21:30:49
Docker
microf, 2020-05-06 21:30:49

How to use my.cng MySql in Docker?

Good afternoon. Have customized containers

version: '3'

services:
    nginx:
        image: nginx:latest    
        ports:
            - "80:80"
            - "443:443"        
        volumes:
            - ./hosts:/etc/nginx/conf.d
            - ./www:/var/www
            - ./logs:/var/log/nginx        
        links:
            - php
    php:        
        build: ./images/php        
        links:
            - mysql        
        volumes:
            - ./www:/var/www
    mysql:
        image: mysql:8
        ports:
            - "3306:3306"
        volumes:
            - ./mysql:/var/lib/mysql        
        environment:
            MYSQL_ROOT_PASSWORD: password

I want to use my MySql settings with my.cnf.
If I add the line to docker-compose
mysql:
        image: mysql:8
        ports:
            - "3306:3306"
        volumes:
            - ./mysql:/var/lib/mysql
      - ./mysql/my.cnf:/etc/my.cnf

to copy my.cnf to docker, nothing happens. Is there somewhere else I need to set it up? Thanks

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sergey, 2020-05-06
@KingstonKMS

Read the original source of what you use https://hub.docker.com/_/mysql

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question