Urgent.News

What's breaking now, across hundreds of outlets.

Tech

Build Your Own Whale ๐Ÿณ, Custom Images with Dockerfile

Introduction Yesterday I ran pre-built containers from Docker Hub. Today, I stepped up from user to creator by packaging my own HTML webpage into a custom Docker image using a Dockerfile , running it as a web server, and testing how container immutability works in practice. 1. Research What is the difference between a Docker Image and a Docker Container? A Docker Image is the read-only blueprintโ€ฆ

Yesterday I transitioned from using pre-built containers from Docker Hub to becoming a creator myself. I packaged my own HTML webpage into a custom Docker image using a Dockerfile, ran it as a web server, and observed container immutability firsthand.

First, I researched the key differences between Docker images and containers. An image is the read-only blueprint containing the app and its dependencies, while a container is the live, running instance created from that image. Next, I explained the purpose of a Dockerfileโ€”a plain-text recipe with step-by-step instructions dictating how to build a custom image automatically. It's essential for ensuring consistent environments across different systems.

I then clarified why Docker requires a Dockerfile for image creation. Without it, Docker lacks the necessary information about the base OS/software, files to copy, and commands to run within the image.

Moving on, I detailed what happens when you edit your HTML file after building the image. Since Docker images are read-only snapshots taken during build time, any changes made to the HTML file won't reflect in the existing image or running container. To update the image, you must rebuild it and start a new container.

Next, I walked through creating a project directory, writing a simple index.html page, and then crafting the Dockerfile. The FROM instruction sets the foundation by pulling the official Apache web server image from Docker Hub. The COPY instruction takes the HTML file from my local project folder and places it inside the image's filesystem. Apache is pre-configured to serve web files from /usr/local/apache2/htdocs/, so placing the HTML file there enables it to be served automatically.

I proceeded to build the custom image and launch it in detached mode, mapping port 8080 on my host machine to port 80 inside the container. After verifying the image existed and the container was running, I accessed the website via http://localhost:8080 to confirm Apache was serving my custom page. I inspected both the container's filesystem and the image to ensure the HTML file was properly packaged.

Finally, I addressed cleanup by stopping and removing the container, and deleting the custom image. I reflected on the experience, noting that changing the HTML file after building the image wouldn't update it since the image is a snapshot taken at build time. To see changes, you'd need to rebuild the image and start a new container.

The most challenging aspect was grasping how port mapping bridges the isolated container network to my local browser and understanding why local file edits don't automatically appear in an already-built image.

Rewritten by urgent.news; may contain errors โ€” check the original.

Source: dev.to

Read the original at dev.to โ†’

Report a problem with this story

More in Tech

Meet in the Middle | CSES - Algoritmit ongelmanratkaisussa

https://cses.fi/alon/task/1628 #include #include #include #include using namespace std ; int dp [ 41 ] [ 41 ] ; int n ; long long x ; long long arr [ 41 ] ; vector getSubsetSum ( int l , int r ) { intโ€ฆ

  • CSES problem-solving platform presents C++ solution
  • Dynamic programming and binary search techniques used
  • Program calculates ways to partition array into subsets with specific sum

Kapper 2.1: already delightful for humans, now rocket fuel for agents

Since Kapper 1.6 , we've shipped six releases โ€” and somewhere along the way, the way people write SQL changed. Most SQL is now written by an agent.

  • Kapper 2.1 improves speed with cacheable templates and optimized query path
  • Self-describing errors introduced in 2.0.0 provide clearer messages for humans and agents

I built a 90-second football manager game (Next.js, no backend)

I wanted a football game that takes 90 seconds, needs no sign-up, and feels like the worst minute of a manager's week. So I built The Manager's Dilemma .

  • "The Manager's Dilemma" is a 90-second football management game
  • No sign-up required, no backend needed
  • Daily scores and streaks stored in local storage

More from Sunday, 29 November 2026 โ†’