{"id":20371570,"url":"https://github.com/atulkamble/docker-python-app","last_synced_at":"2025-08-05T22:36:27.568Z","repository":{"id":246625683,"uuid":"821676692","full_name":"atulkamble/docker-python-app","owner":"atulkamble","description":"This project provides a comprehensive guide to containerizing a Python application using Docker. Follow the steps below to set up your environment, create a Dockerfile, build and push your Docker image, and run your container.","archived":false,"fork":false,"pushed_at":"2024-08-13T07:51:37.000Z","size":26,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-07-28T18:54:28.623Z","etag":null,"topics":["docker","dockerhub","dockerimage","python"],"latest_commit_sha":null,"homepage":"http://linkedin.com/in/atuljkamble","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/atulkamble.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","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},"funding":{"github":"atulkamble"}},"created_at":"2024-06-29T06:00:23.000Z","updated_at":"2024-08-13T07:51:42.000Z","dependencies_parsed_at":"2024-11-15T01:08:31.570Z","dependency_job_id":"8778200e-9a71-43e4-848e-e883b5b7c294","html_url":"https://github.com/atulkamble/docker-python-app","commit_stats":null,"previous_names":["atulkamble/testdevopsproject","atulkamble/docker-python-app"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/atulkamble/docker-python-app","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/atulkamble%2Fdocker-python-app","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/atulkamble%2Fdocker-python-app/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/atulkamble%2Fdocker-python-app/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/atulkamble%2Fdocker-python-app/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/atulkamble","download_url":"https://codeload.github.com/atulkamble/docker-python-app/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/atulkamble%2Fdocker-python-app/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":268986644,"owners_count":24340633,"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","status":"online","status_checked_at":"2025-08-05T02:00:12.334Z","response_time":2576,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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","dockerhub","dockerimage","python"],"created_at":"2024-11-15T01:08:33.655Z","updated_at":"2025-08-05T22:36:27.520Z","avatar_url":"https://github.com/atulkamble.png","language":"Python","readme":"# Dockerizing Python Code\n\n## Clone repo\n```\ngit clone https://github.com/atulkamble/docker-python-app.git\ncd docker-python-app\n```\n\n## Prerequisites\n\n1. **Ensure Docker is installed on your system:**\nInstall Docker if it’s not already installed:\n     ```bash\n     sudo yum install docker -y\n     ```\n\n2. **Install Git:**\nIf Git is not installed, install it:\n     ```bash\n     sudo yum install git -y\n     ```\n\n3. **Install Python:**\nIf Python is not installed, install it:\n     ```bash\n     sudo yum install python -y\n     ```\n\n## Steps to Dockerize Python Code\n\n1. **Clone the Docker Python Project Repository:**\n   ```bash\n   git clone https://github.com/atulkamble/dockerpythonproject.git\n   cd dockerpythonproject\n   ```\n\n2. **Setup Docker:**\nStart the Docker service:\n     ```bash\n     sudo systemctl start docker\n     ```\nEnable Docker to start on boot:\n     ```bash\n     sudo systemctl enable docker\n     ```\nVerify Docker installation:\n     ```bash\n     docker --version\n     ```\n\n3. **Clone the Test DevOps Project Repository:**\n   ```bash\n   git clone https://github.com/atulkamble/testdevopsproject.git\n   cd testdevopsproject/\n   ```\n\n4. **Configure Git:**\nSet up your Git user details:\n     ```bash\n     git config --global user.name \"atulkamble\"\n     git config --global user.email \"atul_kamble@hotmail.com\"\n     ```\n\n5. **Create and Test Python Script:**\nCreate a Python script file:\n     ```bash\n     touch sum.py\n     sudo nano sum.py\n     ```\nAdd your Python code to `sum.py` and test it:\n     ```bash\n     python3 sum.py\n     ```\n\n6. **Create Dockerfile:**\nCreate a Dockerfile:\n     ```bash\n     touch Dockerfile\n     sudo nano Dockerfile\n     ```\nAdd the following content to your Dockerfile:\n     ```dockerfile\n     # Use the official Python image from the Docker Hub\n     FROM python:3.8-slim\n\n     # Set the working directory in the container\n     WORKDIR /app\n\n     # Copy the current directory contents into the container at /app\n     COPY . /app\n\n     # Install any needed packages specified in requirements.txt\n     RUN pip install --no-cache-dir -r requirements.txt\n\n     # Make port 80 available to the world outside this container\n     EXPOSE 80\n\n     # Define environment variable\n     ENV NAME World\n\n     # Run sum.py when the container launches\n     CMD [\"python\", \"sum.py\"]\n     ```\n\n7. **Build and Push Docker Image:**\nLog in to Docker Hub:\n     ```bash\n     sudo docker login\n     ```\nBuild your Docker image:\n     ```bash\n     sudo docker build -t atuljkamble/pythonproject .\n     ```\nVerify the Docker image is built:\n     ```bash\n     sudo docker images\n     ```\nPush the Docker image to Docker Hub:\n     ```bash\n     sudo docker push atuljkamble/pythonproject\n     ```\n\n8. **Run Docker Container:**\nRun your Docker container:\n     ```bash\n     sudo docker run atuljkamble/pythonproject\n     ```\nList all Docker containers to verify it is running:\n     ```bash\n     sudo docker ps -a\n     ```\n\nBy following these steps, you will have successfully Dockerized your Python application, built a Docker image, and run it as a container.\n","funding_links":["https://github.com/sponsors/atulkamble"],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fatulkamble%2Fdocker-python-app","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fatulkamble%2Fdocker-python-app","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fatulkamble%2Fdocker-python-app/lists"}