LoginSignup
7
7

More than 5 years have passed since last update.

Pythonの簡易WebサーバをDockerで起動する

Last updated at Posted at 2016-04-21

マシンのPythonではなくDockerのpythonイメージを使って起動させる。

環境

Mac OSX + Docker Machine (Docker version: 1.10.3)

実行方法

コンテンツのあるフォルダで以下を実行。

Python2の場合

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

Python3の場合

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

アクセス

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

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
7
7