2

I am trying to mount MySql logs on my host machine, using MySql official image. But it seems like its not mounting properly, the directory is always empty, however, the other volumes that I am mounting are working properly. Am I missing something?

version: "2"
services:
  mysql:
    image: mysql:5.7
    restart: always
    environment:
      MYSQL_ROOT_PASSWORD: testing
      MYSQL_DATABASE: testing
      MYSQL_USER: test
      MYSQL_PASSWORD: testing
    ports:
      - 3306:3306
    volumes:
      - ./.data/mysql/logs:/var/log/mysql
      - ./.data/mysql/data:/var/lib/mysql
      - ./mysql/conf.d:/etc/mysql/conf.d
      - ./mysql/initdb.d:/docker-entrypoint-initdb.d
mahadazad
  • 541
  • 5
  • 19
  • Possibly a silly question, but is logging enabled for mysql? Looking at `/etc/mysql/mysql.conf` for this image, error logging is commented out `#log-error = /var/log/mysql/error.log`. – Roman Nov 25 '16 at 17:54
  • Yes, it is enabled. If I remove the mounting statement above. It shows logs inside the container. – mahadazad Nov 28 '16 at 06:21
  • All I want to do is to persist MySql generated logs (https://hub.docker.com/_/mysql/) onto my host machine – mahadazad Nov 29 '16 at 02:43
  • Possible duplicate of [Enable logging in docker mysql container](http://stackoverflow.com/questions/39708213/enable-logging-in-docker-mysql-container) – Roman Nov 30 '16 at 02:17

0 Answers0