0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

手っ取り早くローカルファイルをWebサーバに乗せて確認する

Posted at

ローカルあるhtmlって直接開くとJS動かなかったりしますよね。

そんな時はローカルでWebサーバを立ててファイルを公開ディレクトリに置いてブラウザで開くってやると思います。

ところがdockerがあればコマンド一発で公開できます。

まず、公開したいディレクトリにcdしてから

docker run --name temp-nginx -v $(pwd):/usr/share/nginx/html:ro -d -p 8888:80 nginx

だけで localhost:8888 で開けます。

役目を終えたら

docker rm -f temp-nginx

でdockerコンテナを消せます。

0
0
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
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?