Skip to content

New MySQL (5.7) Docker Container: --initialize specified but the data directory has files in it. Aborting. #700

@TurboCooler

Description

@TurboCooler

So, I did search and found other issues with the same topic --initialize specified but the data directory has files in it. Aborting.

I am new to Docker so the issue could very well be me. Those solutions did not help me. I have been fighting this issue for days.

This is my docker compose file. I am using the latest Docker for Windows. I am using Linux containers. I have given docker permission to the folder on my local file system. I have 64gb free for Docker VM.

I looked at this file
https://github.com/docker-library/mysql/blob/a6b87c55ecdf9426d42ff7814be7e9b1fc33b292/5.7/Dockerfile

It seems I am pointing to the correct internal volume. I want to map the internal files to my local windows file system so I can persist data between sessions. This is a laptop for development.

version: '3.3'
services:
db:
image: mysql:5.7
command: --explicit_defaults_for_timestamp
restart: always
environment:
MYSQL_DATABASE: 'ctestdb'
# So you don't have to use root, but you can if you like
MYSQL_USER: 'ctestuser'
# You can use whatever password you like
MYSQL_PASSWORD: 'ctestdbpwd'
# Password for root access
MYSQL_ROOT_PASSWORD: 'mysqlctestroot'
ports:
# : < MySQL Port running inside container>
- '3306:3306'
expose:
# Opens port 3306 on the container
- '3306'
# Where our data will be persisted
volumes:
- ../localdata/mysql_docker_data_files:/var/lib/mysql

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionUsability question, not directly related to an error with the image

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions