


touch Dockerfile in the root of my website directory and added these lines of code below inside the Dockerfile:FROM nginx:alpine line tells Docker to create a Docker image based on the Nginx web server with Alpine Linux. The COPY . /usr/share/nginx/html line will copy the website content from the directory we are in into the image being built. This means that our website code will replace the default Nginx web server content. EXPOSE 80 specifies that the container should be capable of serving HTTP traffic on port 80.docker build command tells docker to build our website as an image based on the instructions provided in a Dockerfile above. The -t personal-website:v1 tells docker to tag the image personal-website:v1. v1 signifies that this is version 1. The period (.) tells Docker to look for the Dockerfile in the current directory and use the files and directories in this location during the build process.
docker images shows this image I just built:
personal-website and gave it a short description (description is optional).
docker push command below to push the image I built in the previous step, but it failed with the error below 😞.docker tag command to tag my image and then re-ran the docker push command to push to my docker repository.Posted Feb 27, 2025
One of the greatest nightmares of developers is the “It's not working on my machine” problem. I... Tagged with docker, container, devops.
1
1