Simple Docker build example
Example of simple docker build and run This blog shows a very simple example of build a docker image and serve as http server using python. This also covers the concepts of environment variable, volumes and installing packages in building the docker image. Create Files Create the following two files with the contents below: Dockerfile ######################## FROM ubuntu:latest # Install python3 RUN apt-get update RUN apt-get install -y python3 # Set default values for environment variables ENV PORT 8080 # Copy Default Content COPY . /var/www/ # Change to working directory WORKDIR /var/www/ # Expose Ports EXPOSE $PORT # Run Http Server CMD python3 -m http.server $PORT ######################## sample-file.txt My Sample Content..... Build the image docker build --pull -t example/python-http-server:latest -f Dockerfile . Run the image as container docker run --rm -it --name my-python-http-server -p "808...