{"id":24619383,"url":"https://github.com/jwilleke/docker-demo","last_synced_at":"2026-05-08T11:31:52.816Z","repository":{"id":240376337,"uuid":"802465980","full_name":"jwilleke/docker-demo","owner":"jwilleke","description":null,"archived":false,"fork":false,"pushed_at":"2026-03-22T12:41:40.000Z","size":5033,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-03-23T04:20:21.480Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"HTML","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/jwilleke.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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2024-05-18T11:24:13.000Z","updated_at":"2026-03-22T12:41:41.000Z","dependencies_parsed_at":"2024-05-18T12:30:56.495Z","dependency_job_id":"3d97cc5d-0dd3-4b39-bbd2-8d7b374946d4","html_url":"https://github.com/jwilleke/docker-demo","commit_stats":null,"previous_names":["jwilleke/docker-demo"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/jwilleke/docker-demo","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jwilleke%2Fdocker-demo","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jwilleke%2Fdocker-demo/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jwilleke%2Fdocker-demo/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jwilleke%2Fdocker-demo/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jwilleke","download_url":"https://codeload.github.com/jwilleke/docker-demo/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jwilleke%2Fdocker-demo/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32778426,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-08T08:22:46.396Z","status":"ssl_error","status_checked_at":"2026-05-08T08:22:45.650Z","response_time":54,"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":[],"created_at":"2025-01-25T00:51:55.254Z","updated_at":"2026-05-08T11:31:52.801Z","avatar_url":"https://github.com/jwilleke.png","language":"HTML","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Docker Demo\n\nThe simplest kind.\n\nBased on [https://www.cherryservers.com/blog/docker-build-command](https://www.cherryservers.com/blog/docker-build-command)\n\nHow to build a Docker image from Dockerfile: Step-by-step\nTo build a Docker image from Dockerfile, let's see the docker build command in action. In the below steps, we will build a simple Docker image, a web server to serve out a web page through installation. You're going to be building, running, and testing it on your local computer.\n\n## Step 1 - Create a working directory\n\nCreate a directory or folder to use for this demonstration (\"docker-demo\" is used here) and navigate to that directory by running the following commands in your terminal:\n\nmkdir docker-demo\ncd docker-demo\nCreate a file called \"index.html\" in the directory and add the following content to it:\n\n``` html\n\u003c!DOCTYPE html\u003e\n\u003chtml lang=\"en\"\u003e\n  \u003chead\u003e\n    \u003cmeta charset=\"UTF-8\"\u003e\n    \u003ctitle\u003eSimple App\u003c/title\u003e\n  \u003c/head\u003e\n  \u003cbody\u003e\n    \u003ch1\u003eHello World\u003c/h1\u003e\n    \u003cp\u003eThis is running in a docker container\u003c/p\u003e\n  \u003c/body\u003e\n\u003c/html\u003e\n```\n\nThis will serve as the web page to be served up by the server.\n\n## Step 2 - Select a base image\n\nNext, select a suitable base image from Docker Hub or a local repository. The base image forms the foundation of your custom image and contains the operating system and essential dependencies. Almost every single image for Docker is based on another image. For this demonstration, you'd be using nginx:stable-alpine3.17-slim as the base image.\n\n## Step 3 - Create a Dockerfile\n\nNow create a file named \"Dockerfile\". This file will define the build instructions for your image. By default, when you run the docker build command, docker searches for the Dockerfile.\n\n## Step 4 - Add build instructions to the Dockerfile\n\nOpen the Dockerfile in a text editor and add the following lines:\n\n``` bash\nFROM nginx:stable-alpine3.17-slim\nCOPY index.html /usr/share/nginx/html\n\nEXPOSE 80 \nCMD [\"nginx\", \"-g\", \"daemon off;\"]\n```\n\nThe instruction above will create a Docker image that serves the provided \"index.html\" file through the Nginx web server when a container is launched based on that image.\n\nThe FROM instruction initializes a new build stage and sets the base image for subsequent instructions. The COPY instruction copies files or directories (usually the source code) from the source to the specified location inside the image. It copies the file to the \"/usr/share/nginx/html\" directory, which is the default location for serving static files in the Nginx web server. The main purpose of the CMD instruction is to provide defaults for executing containers. The instructions defined in Dockerfiles differ based on the kind of image you're trying to build.\n\n## Step 5 - Build the image using the Docker build command\n\nBefore building the Docker image, confirm that you have Docker installed by running the docker --version command.\n\nconfirm docker install\n\nTo build your container, make sure you're in the folder where you have your Dockerfile and run the following command in the terminal:\n\n``` bash\ndocker build -t dockerdemo:v1 .\n```\n\nThis command initiates the Docker build process to create a Docker image based on the instructions specified in the Dockerfile located in the current directory (.)\n\nThe -t flag specifies a tag for the image, allowing you to assign a name and version to it. In this case, the image will be tagged as \"sampleapp\" with the version \"v1\" providing a descriptive identifier for the image, making it easier to reference and manage.\n\nYou should see the build process start and an output indicating that it has finished when it is done.\n\n## Step 6 - Verify the built Docker image\n\nAfter a successful build, verify the image by running the docker images command to list all the available images on your Docker host. You should see your newly created image listed with its assigned tag and other relevant details, ready to be used for running containers or pushing to a container registry for distribution.\n\n``` bash\ndocker images\n```\n\n## Step 7 - Run the Docker image\n\nNext, run the Docker image as a container using:\n\n``` bash\ndocker run -p 9991:80 aug12018/dockerdemo:latest\n```\n\nThis command tells Docker to run the sampleapp container. The -p flag specifies the port mapping, which maps a port from the host machine to a port inside the container. Here, you are mapping port 8080 of the host machine to port 80 of the container. You can modify the host port as per your preference. Ensure you specify the image name and version you used when building the image.\n\n## Step 8 - Access the application\n\nWith the container running, you can go ahead to access the application. Open a web browser and navigate to \u003chttp://localhost:9991\u003e and you should see the sample web page displayed on your web browser.\n\n## Push dockerdemo image to Registry\n\nTag the image\n\n``` bash\ndocker tag dockerdemo aug12018/dockerdemo:latest\n```\n\nPush the image to Docker Hub\nWhere:\n\n- aug12018 is the user name for Docker Hub\n- latest is the tag which is the build\n\n``` bash\ndocker login\ndocker push aug12018/dockerdemo:latest\n```\n\n\u003e Note: \"aug12018/dockerdemo:latest\" is used in [docker-demo-deployment.yaml](./base/docker-demo-deployment.yaml) file.\n\n## Kubernetties Deployment\n\nIf you did not clone the repository create the following:\n\n``` bash\nmkdir base\ncd base\ntouch docker-demo-deployment.yaml\ntouch docker-demo-ingress.yaml\ncd ..\ntouch docker-demo-namespace.yaml\ntouch kustomization.yaml\n```\n\nAnd refer to the github repository to get file contents.\n\n## 21-Apps\n\n[21-Apps docker-demo](https://github.com/jwilleke/21-apps/tree/master/k8s/apps/docker-demo)\n\n``` bash\ncp -r kustomize/ /Volumes/docs/jim/data/systems/tower/apps/21-apps/k8s/apps/docker-demo/\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjwilleke%2Fdocker-demo","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjwilleke%2Fdocker-demo","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjwilleke%2Fdocker-demo/lists"}