{"id":19737423,"url":"https://github.com/mkhuda/docker-flask-sample","last_synced_at":"2026-04-10T06:54:29.691Z","repository":{"id":148890744,"uuid":"107802111","full_name":"mkhuda/docker-flask-sample","owner":"mkhuda","description":"Docker container with Python 2.7 and Flask (Sample from Get Started)","archived":false,"fork":false,"pushed_at":"2017-10-22T07:07:00.000Z","size":64,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-02-23T07:06:32.189Z","etag":null,"topics":["docker","flask","python"],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mkhuda.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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-10-21T17:43:45.000Z","updated_at":"2017-10-21T17:48:35.000Z","dependencies_parsed_at":null,"dependency_job_id":"fe10b07d-6f5b-4e91-8f93-a2161c5c02cf","html_url":"https://github.com/mkhuda/docker-flask-sample","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/mkhuda%2Fdocker-flask-sample","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mkhuda%2Fdocker-flask-sample/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mkhuda%2Fdocker-flask-sample/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mkhuda%2Fdocker-flask-sample/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mkhuda","download_url":"https://codeload.github.com/mkhuda/docker-flask-sample/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241062953,"owners_count":19902999,"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","flask","python"],"created_at":"2024-11-12T01:11:02.917Z","updated_at":"2025-12-30T21:37:47.039Z","avatar_url":"https://github.com/mkhuda.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# docker-flask-sample\nDocker container with Python 2.7 and Flask (Sample from Get Started)\n\n![Alt text](images/docker-screenshot.png?raw=true \"Web Screenshot\")\n\nThis container was bringin from Docker Get Started Page. I added feature for checking and parsing user agent of visitors.\n\n## Libs Imported\n- Flask\n- pyyaml\n- ua-parser\n- user-agents\n\n## Usages\n1. Clone this image\n2. Run `docker build -t \u003cyour_whathever_image_name\u003e .` (ended with dot)\n3. Run `docker images` to check images\n4. Run `docker run -p 4000:80 \u003cyour_whathever_image_name\u003e` or `docker run -d -p 4000:80 \u003cyour_whathever_image_name\u003e` to detached container on background\n5. Locate to `http://localhost:4000` from your current browser\n\nWant to stop? Run `docker container stop $(docker container ls -a -q)`\n\nTo Remove containers Run `docker container rm $(docker container ls -a -q)`\n\nTo see list of container running, use `docker ps`.\n\n## Service and Swarm\nDocker has a service and swarms feature to demonstrate like load balancing over containers. You need to do is `docker-compose.yml` :\n\n```\nversion: \"3\"\nservices:\n  web:\n    image: emsi_python_sample:latest\n    deploy:\n      replicas: 2\n      resources:\n        limits:\n          cpus: \"0.1\"\n          memory: 50M\n      restart_policy:\n        condition: on-failure\n    ports:\n      - \"80:80\"\n    networks:\n      - webnet\nnetworks:\n  webnet:\n```\n\nI use local image for this project, you don't need a Docker Cloud account.\n\nAnd then run this following commands to make it:\n\n1. Run `docker swarms init` to initialize swarms\n2. Then run `docker stack deploy -c docker-compose.yml pythonproject` to define a new service called *pythonproject*\n3. Run `docker service ls` to check running service\n\n![Alt text](images/service-screenshot.png?raw=true \"Service Screenshot\")\n\n4. Because we ported the app into port 80, you can access this service through `http://localhost:80` and Voila!\n5. Refresh it, and make sure container host ID is changed on every hit.\n\n### Thank you. And happy coding!","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmkhuda%2Fdocker-flask-sample","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmkhuda%2Fdocker-flask-sample","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmkhuda%2Fdocker-flask-sample/lists"}