{"id":26473152,"url":"https://github.com/ragedunicorn/docker-mysql","last_synced_at":"2026-04-02T18:52:37.993Z","repository":{"id":96252011,"uuid":"86064442","full_name":"RagedUnicorn/docker-mysql","owner":"RagedUnicorn","description":"Repository for Docker MySQL image based on Ubuntu","archived":false,"fork":false,"pushed_at":"2019-03-18T20:59:53.000Z","size":41,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-19T21:54:13.334Z","etag":null,"topics":["docker","mysql","ubuntu"],"latest_commit_sha":null,"homepage":"","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/RagedUnicorn.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-03-24T12:14:00.000Z","updated_at":"2021-10-22T19:46:04.000Z","dependencies_parsed_at":null,"dependency_job_id":"c439cd12-8925-47d9-8acb-d7cc84e25c74","html_url":"https://github.com/RagedUnicorn/docker-mysql","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"purl":"pkg:github/RagedUnicorn/docker-mysql","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RagedUnicorn%2Fdocker-mysql","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RagedUnicorn%2Fdocker-mysql/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RagedUnicorn%2Fdocker-mysql/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RagedUnicorn%2Fdocker-mysql/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/RagedUnicorn","download_url":"https://codeload.github.com/RagedUnicorn/docker-mysql/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RagedUnicorn%2Fdocker-mysql/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265450437,"owners_count":23767620,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["docker","mysql","ubuntu"],"created_at":"2025-03-19T21:51:04.334Z","updated_at":"2026-04-02T18:52:37.942Z","avatar_url":"https://github.com/RagedUnicorn.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# docker-mysql\n\n\u003e A docker base to build a container for MySQL based on Ubuntu\n\nThis container is intended to build a base for providing a database to an application stack.\n\n## Version\n\n* MySQL 5.7\n\n### Start container\n\nThe container can be easily started with `docker-compose` command.\n\nNote that the container itself won't be very useful by itself. The default port `3306` is only\nexposed to linked containers. Meaning a connection with a client to the database is not possible with the default configuration.\n\n```\ndocker-compose up -d\n```\n\n### Stop container\n\nTo stop all services from the docker-compose file\n\n```\ndocker-compose down\n```\n\n\n#### Join a swarm\n\n```\ndocker swarm init\n```\n\n#### Create secrets\n```\necho \"some_password\" | docker secret create com.ragedunicorn.mysql.root_password -\necho \"app_user\" | docker secret create com.ragedunicorn.mysql.app_user -\necho \"app_user_password\" | docker secret create com.ragedunicorn.mysql.app_user_password -\n```\n\n#### Deploy stack\n```\ndocker stack deploy --compose-file=docker-compose.stack.yml [stackname]\n```\n\nFor a production deployment a stack should be deployed. Secrets will then be taken into account and MySQL will be setup accordingly.\n\n## Dockery\n\nIn the dockery folder are some scripts that help out avoiding retyping long docker commands but are mostly intended for playing around with the container.\n\n#### Build image\n\nThe build script builds an image with a defined name\n\n```\nsh dockery/dbuild.sh\n```\n\n#### Run container\n\nRuns the built container. If the container was already run once it will `docker start` the already present container instead of using `docker run`\n\n```\nsh dockery/drun.sh\n```\n\n#### Attach container\n\nAttaching to the container after it is running\n\n```\nsh dockery/dattach.sh\n```\n\n#### Stop container\n\nStopping the running container\n\n```\nsh dockery/dstop.sh\n```\n\n## Configuration\n\nMost of the configuration can be changed with the `my.cnf` and `mysqld_charset.cnf` configuration files. Both of those files are copied into the container on buildtime. After a change to one of those files the container must be rebuilt.\n\n#### Default user\n\nFirst time starting up the container a user based on the values of `MYSQL_APP_USER` and `MYSQL_APP_PASSWORD` environmental values is created. This user is also allowed to make external connections and can be used by other services to interact with the database. To modify the setup of this user have a look into `config/user.sql`.\n\n#### Build Args\n\nThe image allows for certain arguments being overridden by build args.\n\n`MYSQL_USER, MYSQL_GROUP, MYSQL_APP_USER, MYSQL_APP_PASSWORD, MYSQL_ROOT_PASSWORD`\n\nThey all have a default value and don't have to be overridden. For details see the Dockerfile.\n\n## Persistence\n\nThe container is storing data in the docker volume configured by the environment variable `${MYSQL_DATA_DIR}`.\n\n## Healthcheck\n\nThe production and the stack image supports a simple healthcheck whether the container is healthy or not. This can be configured inside `docker-compose.yml` or `docker-compose.stack.yml`\n\n## Test\n\nTo do basic tests of the structure of the container use the `docker-compose.test.yml` file.\n\n`docker-compose -f docker-compose.test.yml up`\n\nFor more info see [container-test](https://github.com/RagedUnicorn/docker-container-test).\n\nTests can also be run by category such as command, fileExistence and metadata tests by starting single services in `docker-compose.test.yml`\n\n```\n# basic file existence tests\ndocker-compose -f docker-compose.test.yml up container-test\n# command tests\ndocker-compose -f docker-compose.test.yml up container-test-command\n# metadata tests\ndocker-compose -f docker-compose.test.yml up container-test-metadata\n```\n\nThe same tests are also available for the `dev-image`\n\n```\n# basic file existence tests\ndocker-compose -f docker-compose.test.yml up container-dev-test\n# command tests\ndocker-compose -f docker-compose.test.yml up container-dev-test-command\n# metadata tests\ndocker-compose -f docker-compose.test.yml up container-dev-test-metadata\n```\n\n## Development\n\nTo debug the container and get more insight into the container use the `docker-compose-dev.yml`\nconfiguration. This will also allow external clients to connect to the database. By default the port `3306` will be publicly exposed.\n\n```\ndocker-compose -f docker-compose-dev.yml up -d\n```\n\nBy default the launchscript `/docker-entrypoint.sh` will not be used to start the MySQL process. Instead the container will be setup to keep `stdin_open` open and allocating a pseudo `tty`. This allows for connecting to a shell and work on the container. MySQL itself can be started with `./docker-entrypoint.sh`.\n\n## Links\n\nUbuntu packages database\n- http://packages.ubuntu.com/\n\n## License\n\nCopyright (c) 2019 Michael Wiesendanger\n\nPermission is hereby granted, free of charge, to any person obtaining\na copy of this software and associated documentation files (the\n\"Software\"), to deal in the Software without restriction, including\nwithout limitation the rights to use, copy, modify, merge, publish,\ndistribute, sublicense, and/or sell copies of the Software, and to\npermit persons to whom the Software is furnished to do so, subject to\nthe following conditions:\n\nThe above copyright notice and this permission notice shall be\nincluded in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\nEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\nMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\nNONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE\nLIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\nOF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION\nWITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fragedunicorn%2Fdocker-mysql","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fragedunicorn%2Fdocker-mysql","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fragedunicorn%2Fdocker-mysql/lists"}