create a Dockerfile
this image will install python and start a SimpleHTTPServer:
FROM ubuntu ENV DEBIAN_FRONTEND noninteractive CMD ["bash"] RUN apt-get update RUN apt-get install -y python EXPOSE 8000 CMD python -m SimpleHTTPServer 8000
Build project
docker build -t myapp:latest .
run docker image
docker run -P myapp
-P for port forwarding: Publish all exposed ports to random ports
check the web page
find port by:
docker ps -l
This project can be found here:
https://github.com/guoliang-dev/docker-hello-world-python
// Proudly powered by Apache, PHP, MySQL, WordPress, Bootstrap, etc,.