LoginSignup
7
5

More than 5 years have passed since last update.

Vue.js 環境をDocker化しようとしたら接続できなかった

Last updated at Posted at 2018-05-11

npm run dev を docker から実行したかった。動かなかった。
EXPOSE も docker run -p も指定したのに動かなかった。


--host 0.0.0.0 を足したら動いた。

package.json
{
  ...
  "scripts": {
    "dev": "webpack-dev-server --host 0.0.0.0 --inline --progress --config build/webpack.dev.conf.js",
    ...
  }
}

(追記) 上記方法は駄目。以下の方法。

disableHostCheck: true

参考

成功した後に見つけたので試してないけど、 config/index.js で host を 0.0.0.0 に直しても動くらしい。
https://qiita.com/Yorinton/items/938cda034334cdcfcb72

(追記)
ただし、こいつを指定した場合、 今度は local 環境から localhost でアクセスすることが出来なくなるので注意。

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