Start a simple Python web server with Docker

Launch using Docker's python image instead of the machine's python.

environment

Mac OSX + Docker Machine (Docker version: 1.10.3)

Execution method

Execute the following in the folder with the contents.

For Python2

docker run -it --rm -p 8888:8888 -v `pwd`:/app -w /app python:2-alpine python -m SimpleHTTPServer 8888

For Python 3

docker run -it --rm -p 8888:8888 -v `pwd`:/app -w /app python:3-alpine python -m http.server 8888

access

open "http://`docker-machine ip default`:8888"

Recommended Posts

Start a simple Python web server with Docker
Put Docker in Windows Home and run a simple web server with Python
Run a Python web application with Docker
Launch a web server with Python and Flask
Launch a Python web application with Nginx + Gunicorn with Docker
[Vagrant] Set up a simple API server with python
Creating a Flask server with Docker
Create a simple Python development environment with VSCode & Docker Desktop
Creating a simple PowerPoint file with Python
Set up a Samba server with Docker
Daemonize a Python web app with Supervisor
[Python] A quick web application with Bottle!
Create a simple web app with flask
Let's make a web framework with Python! (1)
Create a web service with Docker + Flask
Let's make a web framework with Python! (2)
I made a simple blackjack with Python
Create a simple Python development environment with VS Code and Docker
Start a temporary http server locally with Pytest
Tftp server with Docker
Set up a simple HTTPS server in Python 3
Set up a simple HTTPS server with asyncio
Python Web Content made with Lolipop cheap server
[Python] Build a Django development environment with Docker
[Python] Make a simple maze game with Pyxel
Build a CentOS Linux 8 environment with Docker and start Apache HTTP Server
Use python with docker
Proxy server with Docker
Set up a simple SMTP server in Python
A simple to-do list created with Python + Django
Local server with python
Extract data from a web page with Python
Implement a simple application with Python full scratch without using a web framework.
Introduction and usage of Python bottle ・ Try to set up a simple web server with login function
[Python] How to create a local web server environment with SimpleHTTPServer and CGIHTTPServer
I made a ready-to-use syslog server with Play with Docker
A simple Python HTTP server that supports Range Requests
Let's make a simple game with Python 3 and iPhone
A server that echoes data POSTed with flask / python
Create a Layer for AWS Lambda Python with Docker
A memo about building a Django (Python) application with Docker
What is God? Make a simple chatbot with python
Create a fake Minecraft server in Python with Quarry
Web scraping with python + JupyterLab
Create a (simple) REST server
Prepare python3 environment with Docker
Web API with Python + Falcon
Make a fortune with Python
Easy HTTP server with Python
Simple HTTP Server for python
Web application with Python + Flask ② ③
Create a simple textlint server
Web scraping beginner with python
Create a directory with python
Streamline web search with python
Web application with Python + Flask ④
[Mac] I want to make a simple HTTP server that runs CGI with Python
Hello World is a simple web server that follows WSGI (Web Server Gateway Interface) in Python.
I made a simple typing game with tkinter in Python
I made a simple book application with python + Flask ~ Introduction ~
Build a speed of light web API server with Falcon