{"id":26587888,"url":"https://github.com/borischen0203/docker-db-sample","last_synced_at":"2026-04-29T23:31:40.280Z","repository":{"id":174076627,"uuid":"651732677","full_name":"borischen0203/docker-db-sample","owner":"borischen0203","description":"This sample mainly set up mysql database by docker.","archived":false,"fork":false,"pushed_at":"2024-08-04T00:38:03.000Z","size":8,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-12-24T10:18:14.870Z","etag":null,"topics":["docker","docker-compose","makefile","mysql"],"latest_commit_sha":null,"homepage":"","language":"Makefile","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/borischen0203.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,"zenodo":null}},"created_at":"2023-06-10T00:01:15.000Z","updated_at":"2024-08-03T23:22:06.000Z","dependencies_parsed_at":null,"dependency_job_id":"6ccfbe1b-3e22-4a95-93a5-b11982e68055","html_url":"https://github.com/borischen0203/docker-db-sample","commit_stats":null,"previous_names":["borischen0203/docker-db-sample"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/borischen0203/docker-db-sample","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/borischen0203%2Fdocker-db-sample","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/borischen0203%2Fdocker-db-sample/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/borischen0203%2Fdocker-db-sample/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/borischen0203%2Fdocker-db-sample/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/borischen0203","download_url":"https://codeload.github.com/borischen0203/docker-db-sample/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/borischen0203%2Fdocker-db-sample/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32448365,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-29T22:27:22.272Z","status":"ssl_error","status_checked_at":"2026-04-29T22:10:49.234Z","response_time":110,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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","docker-compose","makefile","mysql"],"created_at":"2025-03-23T12:31:12.884Z","updated_at":"2026-04-29T23:31:40.265Z","avatar_url":"https://github.com/borischen0203.png","language":"Makefile","funding_links":[],"categories":[],"sub_categories":[],"readme":"# docker-db-sample\n![](https://miro.medium.com/v2/resize:fit:656/0*3nbGUAgh6fFop3qB.)\n\nThis sample mainly set up `mysql` database by docker.\n# How to use\n\n#### Required:\n- Install `docker`\n- Install `make` command(https://formulae.brew.sh/formula/make)\n```bash\nbrew install make\n```\n\n#### Setup your configuration:\nBelow is a java `application.properties` sample\n```bash\nspring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver\nspring.datasource.url=jdbc:mysql://localhost:3306/testDB\nspring.datasource.username=root\nspring.datasource.password=password\nspring.jpa.database-platform=org.hibernate.dialect.MySQL5InnoDBDialect\nspring.jpa.hibernate.ddl-auto=update\n```\n- `localhost:3306`  should be same as `ports` in docker-compose.yml\n- `testDB` is database name, it should be same as `MYSQL_DATABASE`  in docker-compose.yml\n- `password` is tha password value, it should be same as `MYSQL_ROOT_PASSWORD` in docker-compose.yml\n\n```yml\nversion: '3.7'\n\nservices:\n  mysql:\n    image: mysql:5.7\n    platform: linux/amd64\n    restart: unless-stopped\n    container_name: docker-mysql\n    environment:\n      MYSQL_ROOT_PASSWORD: password\n      MYSQL_DATABASE: testDB\n    ports:\n      - \"3306:3306\"\n```\n\n---\n\n### Run steps\nStep 1: Clone the repo\n```bash\ngit clone https://github.com/borischen0203/docker-db-sample.git\n```\n\nStep 2: Run the container\n```bash\nmake docker-up\n```\nOr\n```bash\ndocker compose -f docker-compose.yml up -d --build\n```\n---\n### Run demo:\n- Use `make docker-up` to run the container\n```bash\n$ make docker-up\nRun docker container - docker-mysql!\ndocker compose -f docker-compose.yml up -d --build\n[+] Running 2/2\n ✔ Network docker-db-sample_default  Created  \n ✔ Container docker-mysql            Started \n```\n---\n- Use `make docker-exec` to into the container\n```bash\n$ make docker-exec                                                 \nRun docker exec command into container - docker-mysql\ndocker exec -it docker-mysql /bin/sh\n```\nThen, you can use below way to into mysql \\\n`-u`: means username, we use `root` here \\\n`-p`: means user password, same as you set up in `docker-compose.yml`'s `MYSQL_ROOT_PASSWORD`\n```\n# mysql -uroot -ppassword\n# mysql: [Warning] Using a password on the command line interface can be insecure.\nWelcome to the MySQL monitor.  Commands end with ; or \\g.\nYour MySQL connection id is 2\nServer version: 5.7.37 MySQL Community Server (GPL)\n\nCopyright (c) 2000, 2022, Oracle and/or its affiliates.\nmysql\u003e \n```\n\n---\n\n- Use `make docker-down` to stop the container\n```bash\n$ make docker-down \nTerminate docker container - docker-mysql\ndocker-compose -f docker-compose.yml down\n[+] Running 2/1\n ✔ Container docker-mysql            Removed           \n ✔ Network docker-db-sample_default  Removed \ndocker system prune\nWARNING! This will remove:\n  - all stopped containers\n  - all networks not used by at least one container\n  - all dangling images\n  - all dangling build cache\n\nAre you sure you want to continue? [y/N] y\nTotal reclaimed space: 0B\n```\n---\nOption:\nYou can use `volumes` and `dump.sql`(File location: /docker/mysql/dump.sql) to set up a default table in DB\n```yml\nvolumes:\n  - \"./docker/mysql/dump.sql:/docker-entrypoint-initdb.d/dump.sql\"\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fborischen0203%2Fdocker-db-sample","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fborischen0203%2Fdocker-db-sample","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fborischen0203%2Fdocker-db-sample/lists"}