Docker Community Forums

Share and learn in the Docker community.

Docker - mysql user defined volume

I referred https://hub.docker.com/_/mysql and try to bring up container with user defined datadir location , port, socket etc. but still I see mysql is running on default port 3306.
Question - Is it possible to run mysql docker container with user defined parameters in .cnf file while creating first time? If yes, I wonder if there is a document to bring up container with user defined parameter in .cnf file.

Thanks
Shrenik

You find the answer on the page you mentioned under ‘Using a custom MySQL configuration file’.
Now the question is, what exactly do you want to achieve, or why is it a problem that MySQL in the container listens to 3306? You can map it to any port on the host machine, so if you want to access it for example at port 3399, you can write

docker container run -p 3399:3306 [other parameters here] mysql

Thanks for your time and response.

Shrenik