docker build reads your Dockerfile and builds a new image from it. This is the step where your own app gets turned into a reusable image.
dockerfile
# In the same directory as your Dockerfile
docker build -t my-custom-nginx:1.0 .
# Run the image as a container
docker run --name my-site -d -p 8080:80 my-custom-nginx:1.0
# Open http://localhost:8080 in your browser-t my-custom-nginx:1.0 gives the image a name and tag. And at the very end, the . is the build context — it sends the Dockerfile and any needed files from the current folder into the Docker build process.
You should see
Once the build steps finish, you'll have a my-custom-nginx:1.0 image, and you'll be able to view the site in your browser.Info
If your build context has a lot of unnecessary large files, the build can slow down. In a real project, .dockerignore should be added, and node_modules, logs, and cache files should be excluded.