{"id":24997944,"url":"https://github.com/yogitabadhe/dockerizing_python_code","last_synced_at":"2026-04-11T11:02:20.311Z","repository":{"id":275609801,"uuid":"926620475","full_name":"YogitaBadhe/Dockerizing_python_Code","owner":"YogitaBadhe","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":"2025-02-03T15:45:31.000Z","size":6,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-03T16:31:16.632Z","etag":null,"topics":["aws","docker","dockercontainers","dockerfile","dockerimages","github"],"latest_commit_sha":null,"homepage":"","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/YogitaBadhe.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":"2025-02-03T15:25:22.000Z","updated_at":"2025-02-03T15:45:34.000Z","dependencies_parsed_at":"2025-02-03T16:32:01.858Z","dependency_job_id":"1f91b777-23c7-441e-b654-4db1ba24c332","html_url":"https://github.com/YogitaBadhe/Dockerizing_python_Code","commit_stats":null,"previous_names":["yogitabadhe/dockerizing_python_code"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/YogitaBadhe%2FDockerizing_python_Code","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/YogitaBadhe%2FDockerizing_python_Code/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/YogitaBadhe%2FDockerizing_python_Code/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/YogitaBadhe%2FDockerizing_python_Code/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/YogitaBadhe","download_url":"https://codeload.github.com/YogitaBadhe/Dockerizing_python_Code/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246210095,"owners_count":20741109,"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":["aws","docker","dockercontainers","dockerfile","dockerimages","github"],"created_at":"2025-02-04T17:26:44.989Z","updated_at":"2026-04-11T11:02:15.263Z","avatar_url":"https://github.com/YogitaBadhe.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"# Dockerizing Python Code for Tic-Tac-Toe Game\n\nThis project demonstrates how to Dockerize a simple Python-based Tic-Tac-Toe game. By the end of this guide, you'll have a containerized Python application that you can run anywhere using Docker.\n\n## Clone Repo\nTo get started, clone the repository and navigate into the project folder:\n```bash\ngit clone https://github.com/YogitaBadhe/Dockerizing_python_Code.git\ncd Dockerizing_python_Code\n```\n\n## Prerequisites\n\nBefore you begin, ensure that you have the following installed:\n\n### 1. **Docker**\nEnsure that Docker is installed on your system. If not, you can install Docker using the following command:\n```bash\nsudo yum install docker -y\n```\n\n### 2. **Git**\nYou need Git to clone the repository. If you don't have Git installed, use:\n```bash\nsudo yum install git -y\n```\n\n### 3. **Python**\nYou will need Python installed to test the Tic-Tac-Toe game. Install Python if it's not already on your system:\n```bash\nsudo yum install python -y\n```\n\n## Steps to Dockerize Python Code\n\n### 1. **Setup Docker**\nStart the Docker service and enable it to start on boot:\n```bash\nsudo systemctl start docker\nsudo systemctl enable docker\n```\nVerify your Docker installation:\n```bash\ndocker --version\n```\n\n### 2. **Configure Git**\nConfigure your Git user details (optional but recommended):\n```bash\ngit config --global user.name \"YogitaBadhe\"\ngit config --global user.email \"ybadhe0990@gmail.com\"\n```\n\n### 3. **Create and Test Python Script**\nCreate the Python script for your Tic-Tac-Toe game:\n```bash\nsudo touch tic-tac-toe.py\nsudo nano tic-tac-toe.py\n```\n\nPaste your Python code into the file, then test it locally:\n```bash\npython3 tic-tac-toe.py\n```\n\n### 4. **Create Dockerfile**\nCreate a `Dockerfile` in the root of your project directory:\n```bash\ntouch Dockerfile\nsudo nano Dockerfile\n```\n\nAdd the following content to the `Dockerfile`:\n```dockerfile\n# Use the official Python image from the Docker Hub\nFROM python:3.8-slim\n\n# Set the working directory in the container\nWORKDIR /app\n\n# Copy the current directory contents into the container at /app\nCOPY . /app\n\n# Run tic-tac-toe.py when the container launches\nCMD [\"python\", \"tic-tac-toe.py\"]\n```\n\n### 5. **Build and Push Docker Image**\n\n1. **Log in to Docker Hub (if you haven’t already):**\n   ```bash\n   sudo docker login\n   ```\n\n2. **Build the Docker image**:\n   ```bash\n   sudo docker build -t ybadhe/pythonproject .\n   ```\n\n3. **Verify the Docker image is built**:\n   ```bash\n   sudo docker images\n   ```\n\n4. **Push the Docker image to Docker Hub**:\n   ```bash\n   sudo docker push ybadhe/pythonproject\n   ```\n\n### 6. **Run Docker Container**\n\n1. **Run your Docker container**:\n   ```bash\n   sudo docker run ybadhe/pythonproject\n   ```\n\n2. **List all running Docker containers**:\n   ```bash\n   sudo docker ps -a\n   ```\n\n---\n\n## Interacting with the Game\n\nOnce the container is running, you'll interact with the Tic-Tac-Toe game through the terminal. The game will prompt you to enter row and column numbers for player moves (e.g., `0 1` for row 0, column 1).\n\n### Sample Gameplay:\n```\nTic-Tac-Toe Game\n| X |   |   |\n---------\n|   | O |   |\n---------\n|   |   | X |\nPlayer X, enter row and column (0-2): 1 1\nPlayer O, enter row and column (0-2): 0 0\n...\n```\n\n### 7. **Stopping the Docker Container**\nTo stop the container, use the following command:\n```bash\nsudo docker stop \u003ccontainer_id\u003e\n```\nYou can get the `\u003ccontainer_id\u003e` by running:\n```bash\nsudo docker ps -a\n```\n\n---\n\n## Conclusion\n\nBy following these steps, you have successfully Dockerized a Python Tic-Tac-Toe game. You can now run the game as a Docker container on any machine that supports Docker.\n\nIf you encounter any issues, please open an issue on the repository, and I'll assist you as soon as possible.\n\n---\n\nThis README provides clear instructions for setting up, Dockerizing, and running the Python Tic-Tac-Toe game.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyogitabadhe%2Fdockerizing_python_code","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fyogitabadhe%2Fdockerizing_python_code","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyogitabadhe%2Fdockerizing_python_code/lists"}