Navigate to the www dir which you would like to use as web root
Create a new file call http.py (you can use any file name) with following content
Run the following test command
sudo docker run -it --rm --name my-running-script -p 8000:8000 -v "$PWD":/usr/src/myapp -w /usr/src/myapp python:2 python http.py
Test:
root@fengUbuntu:~/certs# curl http://localhost:8000/http.py
import SimpleHTTPServer
import SocketServer
PORT = 8000
Handler = SimpleHTTPServer.SimpleHTTPRequestHandler
httpd = SocketServer.TCPServer(("", PORT), Handler)
print "serving at port", PORT
httpd.serve_forever()
Feng
没有评论:
发表评论