setting system variables in MySQL running as docker container

I have used docker to setup mysql server taken from , I know that we can set up environment variables using several options while running an image as”-e , -env or –env-file” which works absolutely fine as I want. But now I want to edit my system variables for MySQL say “max_connections=300”. Is there a way we can use these options to achieve this. I have tried using –env-file option to update system variables but no success 🙁 would be really very helpful if anyone can give pointers on this.


  • How to allow my host IP address in the PostgreSQL pg_hba.conf file
  • Putting databases in their own Docker containers?
  • gcloud docker push reliability
  • Jenkins docker plugin and linked slaves
  • Multiple docker containers as web server on a single IP
  • Docker: elastic search image with preloaded schema/data
  • AEM is installed under /var in DOCKER , I need to move the same to /opt as I am facing space issue
  • Missing package
  • How to mount volumes to global volume in Docker Swarm and bundle
  • How do I create a Docker container with a hostname that an other container can use?
  • DashDB local (docker) failed to start because database services didn't start
  • Using Docker to build an image for Node, my Express based Node app, MongoDb, and NodeBB, connected via Passport
  • 2 Solutions collect form web for “setting system variables in MySQL running as docker container”

    Have a look at, for example for a specific value for max_connections, and for the Dockerfile

    From description of mysql docker container:

    You can pass arbitrary command line options to the MySQL server by appending them to the run command:

    docker run –name my-container-name -d mysql/mysql-server –option1=value –option2=value
    In this case, the values of option1 and option2 will be passed directly to the server when it is started. The following command will for instance start your container with UTF-8 as the default setting for character set and collation for all databases in MySQL:

    docker run –name my-container-name -d mysql/mysql-server –character-set-server=utf8 –collation-server=utf8_general_ci

    Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.