{"id":24121303,"url":"https://github.com/jojoarianto/docker-for-local-development","last_synced_at":"2026-05-14T10:37:02.862Z","repository":{"id":87507093,"uuid":"232392498","full_name":"jojoarianto/docker-for-local-development","owner":"jojoarianto","description":"Cheatsheet and explanation how to use docker for local development","archived":false,"fork":false,"pushed_at":"2020-03-29T12:37:10.000Z","size":17,"stargazers_count":3,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-11T10:51:57.179Z","etag":null,"topics":["database","docker"],"latest_commit_sha":null,"homepage":null,"language":null,"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/jojoarianto.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":"2020-01-07T18:44:13.000Z","updated_at":"2024-04-12T16:53:47.000Z","dependencies_parsed_at":null,"dependency_job_id":"2aaa7fb1-09f7-4c60-84ec-7bee82bcdf6f","html_url":"https://github.com/jojoarianto/docker-for-local-development","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jojoarianto%2Fdocker-for-local-development","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jojoarianto%2Fdocker-for-local-development/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jojoarianto%2Fdocker-for-local-development/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jojoarianto%2Fdocker-for-local-development/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jojoarianto","download_url":"https://codeload.github.com/jojoarianto/docker-for-local-development/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241202193,"owners_count":19926564,"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":["database","docker"],"created_at":"2025-01-11T10:51:42.005Z","updated_at":"2026-05-14T10:36:57.843Z","avatar_url":"https://github.com/jojoarianto.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"# Docker for local development\nCheatsheet and explanation how to use docker for local development\n\n![image](https://user-images.githubusercontent.com/5858756/72198236-2c6a7a80-345d-11ea-8708-7f460f718478.png)\n\n[Docker for development - Run mysql, postgres, mongodb, redis with docker (Bahasa)](https://www.youtube.com/watch?v=yP4OHzpKjAU)\n\n## Goal :\n- Know how to use docker for local development purpose\n\n## Inspired by : \n- [Hackernoon - Dont install postgres docker pull postgres](https://hackernoon.com/dont-install-postgres-docker-pull-postgres-bee20e200198).\n\n## Todo : \n- Mysql\n- Postgresql\n- Mongodb\n- Redis\n\n## Docker command cheatsheet \n\n### Docker container\n- ```docker ps```\n\tto see docker container (running container only)\n- ```docker ps -a```\n\tto see docker container (running + non active)\n- ```docker stop container_id```\n  to stop running container\n- ```docker kill container_id```\n  to stop \u0026 remove running container\n\n\n### Docker images\n- ```docker images```\n\tto see list docker images\n\n### Docker volume\n- ```docker volume ls```\n   to see list docker volume\n- ```docker volume create volume_name```\n   to create docker volume\n   \n\n## Flags explaination\n-   -d : run on background\n- --rm : clean up container after stop\n-   -v : volume\n-   -p : port forwarding\n-   -e : docker environment variable\n\n# Script\nCheatsheet\n### Mysql \nmysql version 5.7\n```bash\ndocker run --rm \\\n   --name local_mysql \\\n   -v mysql_data:/var/lib/mysql \\\n   -e MYSQL_ROOT_PASSWORD=secret \\\n   -p 3306:3306 \\\n   -d mysql:5.7\n```\n\nor in oneline command\n```\ndocker run --rm --name local_mysql -v mysql_data:/var/lib/mysql -e MYSQL_ROOT_PASSWORD=secret -p 3306:3306 -d mysql\n```\n\nto stop container run\n```\ndocker stop local_mysql\n```\n\nconnect with db url\n```\nmysql://root:secret@127.0.0.1\n```\n\nOfficial Images : https://hub.docker.com/_/mysql\n\n### Postgresql\n```\ndocker run --rm \\\n   --name local_postgres \\\n   -e POSTGRES_USER=root \\\n   -e POSTGRES_PASSWORD=secret \\\n   -p 5432:5432 \\\n   -v postgres_data:/var/lib/postgresql \\\n   -d postgres\n```\n\nconnect with db url\n```\npostgresql://root:secret@127.0.0.1\n```\nOfficial images of postgresql : https://hub.docker.com/_/postgres\n\n### Mongodb\n```\ndocker run --rm \\\n   --name local_mongodb \\\n   -e MONGO_INITDB_ROOT_USERNAME=root \\\n   -e MONGO_INITDB_ROOT_PASSWORD=secret \\\n   -p 27017:27017 \\\n   -v mongodb_data:/data/db \\\n   -d mongo\n```\nconnect with db url\n```\nmongodb://root:secret@localhost:27017\n```\nOfficial Images of mongodb : https://hub.docker.com/_/mongo\n\n#### mongod-express\nmongo-express is Web-based MongoDB admin interface, written with Node.js and express (just like phpmyadmin for mysql)\n\n```\ndocker run -it --rm \\\n    --network bridge \\\n    --name mongo-express \\\n    -p 8081:8081 \\\n    -e ME_CONFIG_MONGODB_SERVER=\"host.docker.internal\" \\\n    -e ME_CONFIG_MONGODB_ENABLE_ADMIN=true \\\n    -e ME_CONFIG_MONGODB_URL=\"mongodb://root:secret@localhost:27017/?authSource=admin\" \\\n    -e ME_CONFIG_MONGODB_ADMINUSERNAME=\"root\" \\\n    -e ME_CONFIG_MONGODB_ADMINPASSWORD=\"secret\" \\\n    mongo-express\n```\n\n### Redis\n```\ndocker run --rm \\\n   -p 6379:6379 \\\n   --name local_redis \\\n   -d redis\n```\nconnect with db url \n```\nredis://@127.0.0.1\n```\nOfficial images of  redis : https://hub.docker.com/_/redis\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjojoarianto%2Fdocker-for-local-development","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjojoarianto%2Fdocker-for-local-development","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjojoarianto%2Fdocker-for-local-development/lists"}