{"id":15127635,"url":"https://github.com/dporkka/docker-101","last_synced_at":"2026-01-19T12:33:22.635Z","repository":{"id":241907413,"uuid":"808173939","full_name":"dporkka/docker-101","owner":"dporkka","description":"How to clone a GitHub repo to a Docker container","archived":false,"fork":false,"pushed_at":"2024-05-30T14:42:22.000Z","size":2,"stargazers_count":4,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-05T19:18:42.557Z","etag":null,"topics":["docker","docker-container","docker-image","dockerfile","github"],"latest_commit_sha":null,"homepage":"https://github.com/dporkka/docker-101/blob/main/README.md","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/dporkka.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":"2024-05-30T14:30:01.000Z","updated_at":"2025-03-25T18:03:36.000Z","dependencies_parsed_at":"2024-05-30T18:01:53.222Z","dependency_job_id":null,"html_url":"https://github.com/dporkka/docker-101","commit_stats":null,"previous_names":["dporkka/docker-101"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/dporkka/docker-101","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dporkka%2Fdocker-101","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dporkka%2Fdocker-101/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dporkka%2Fdocker-101/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dporkka%2Fdocker-101/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dporkka","download_url":"https://codeload.github.com/dporkka/docker-101/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dporkka%2Fdocker-101/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28567897,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-19T08:53:44.001Z","status":"ssl_error","status_checked_at":"2026-01-19T08:52:40.245Z","response_time":67,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: 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-container","docker-image","dockerfile","github"],"created_at":"2024-09-26T02:05:09.613Z","updated_at":"2026-01-19T12:33:22.619Z","avatar_url":"https://github.com/dporkka.png","language":null,"readme":"# How to clone a github repo into docker\n\n## Step 1: Create a Dockerfile\n\nA Dockerfile is a script that contains instructions to build a Docker image. Here's a basic example:\n\n`# Use a base image\nFROM ubuntu:latest\n\n# Install necessary packages\nRUN apt-get update \u0026\u0026 apt-get install -y \\\n    git \\\n    \u0026\u0026 rm -rf /var/lib/apt/lists/*\n\n# Set the working directory\nWORKDIR /app\n\n# Clone the GitHub repository\nRUN git clone https://github.com/username/repository.git\n\n# Set the working directory to the cloned repository\nWORKDIR /app/repository\n\n# Define the command to run when the container starts\nCMD [\"bash\"]`\n\n## Step 2: Build the Docker Image\n\nNavigate to the directory containing the Dockerfile and build the Docker image using the docker build command. Replace my-git-clone with a name for your Docker image.\n\n`docker build -t my-git-clone .`\n\n## Step 3: Run the Docker Container\n\nOnce the Docker image is built, you can run a container from this image using the docker run command:\n\n`docker run -it my-git-clone`\n\nThis command runs the container in interactive mode and starts a bash session.\n\n## Example Dockerfile Explained\n\n-   **FROM ubuntu**: Uses the latest Ubuntu base image.\n-   **RUN apt-get update \u0026\u0026 apt-get install -y git**: Updates the package list and installs Git.\n-   **WORKDIR /app**: Sets the working directory inside the container.\n-   **RUN git clone \u003chttps://github.com/username/repository.git\u003e**: Clones the specified GitHub repository into the working directory.\n-   **WORKDIR /app/repository**: Sets the working directory to the cloned repository.\n-   **CMD [\"bash\"]**: Starts a bash session when the container runs.\n\n## Customizing the Dockerfile\n\nYou can customize the Dockerfile according to your needs, such as specifying a particular branch or commit to clone, installing additional dependencies, or running specific commands after cloning the repository.\n\n## Example with Specific Branch\n\nIf you want to clone a specific branch, you can modify the `git clone` command in the Dockerfile:\n\n`RUN git clone --branch branch-name https://github.com/username/repository.git`\n\n## Full Example\n\nHere's a complete example Dockerfile for cloning a specific branch and installing additional dependencies:\n\n`FROM ubuntu:latest\n\nRUN apt-get update \u0026\u0026 apt-get install -y\\\n    git\\\n    python3\\\n    python3-pip\\\n    \u0026\u0026 rm -rf /var/lib/apt/lists/*\n\nWORKDIR /app\n\nRUN git clone --branch branch-name https://github.com/username/repository.git\n\nWORKDIR /app/repository\n\nRUN pip3 install -r requirements.txt\n\nCMD [\"bash\"]`\n\nBy following these steps, you can clone a GitHub repository into a Docker container, customize the environment, and run any necessary commands.","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdporkka%2Fdocker-101","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdporkka%2Fdocker-101","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdporkka%2Fdocker-101/lists"}