【发布时间】:2018-12-10 21:51:28
【问题描述】:
我使用以下命令来运行容器:
docker run -p 3333:3333 -d maill/node-web-app
这是 docker ps 的结果:
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
f26270107bfa maill/node-web-app "npm run dev" 49 seconds ago Up 46 seconds 0.0.0.0:3000->3000/tcp musing_fermi
但是,当我尝试使用 localhost:3333 访问主机上的网络服务器时,它不起作用。
我使用的是 Windows 10 专业版。
docker logs musing_fermi 显示:
DONE Compiled successfully in 3541ms16:04:50 | OPEN localhost:3000
Docker 文件:
FROM node:8
WORKDIR /usr/src/app
COPY package*.json ./
RUN npm i
COPY . .
EXPOSE 3333
CMD [ "npm", "run", "dev" ]
package.json:
{
"name": "webapp-pst-horizon",
"version": "1.0.0",
"description": "Webapp pour les formations enedis",
"author": "Léo Coletta",
"private": true,
"scripts": {
"dev": "cross-env HOST=0.0.0.0 PORT=3333 nuxt",
"build": "nuxt build",
"start": "nuxt start",
"generate": "nuxt generate",
"lint": "eslint --ext .js,.vue --ignore-path .gitignore .",
"precommit": "npm run lint"
},
"dependencies": {
"@nuxtjs/axios": "^5.3.1",
"@nuxtjs/proxy": "^1.2.4",
"axios": "^0.18.0",
"babel-polyfill": "^6.26.0",
"cookie": "^0.3.1",
"js-cookie": "^2.2.0",
"nuxt": "^1.4.1",
"vuetify": "^1.0.19",
"webpack": "^3.1.0"
},
"devDependencies": {
"babel-eslint": "^8.2.3",
"cross-env": "^5.2.0",
"eslint": "^4.9.0",
"eslint-config-airbnb-base": "^12.1.0",
"eslint-loader": "^2.0.0",
"eslint-plugin-import": "^2.7.0",
"eslint-plugin-vue": "^4.5.0",
"stylus": "^0.54.5",
"stylus-loader": "^3.0.2"
}
}
【问题讨论】:
-
您尝试使用什么协议来访问它?
-
doesn't work是什么意思? -
docker logs musing_fermi说什么? -
我在主机的 chome 中收到“此页面无法正常工作”。我正在尝试使用 localhost:3000 @johnharris85 通过 HTTP 协议访问它
-
` DONE 3541ms16:04:50 编译成功 |打开localhost:3000`@zero298
标签: docker