Localhost连接由peer,docker container(ubuntu)运行angularjs webpack app重置

时间:2017-12-01 12:43:12

标签: ubuntu docker networking

我在ubuntu容器中运行我的webapp,使用以下dockerfile:

@Html.Partial("~/Views/Shared/_partialItem.cshtml",new DifferentModel(){})

我使用tr:nth-child(-n+3) { color: red; } 启动应用应用,返回:

# docker.webpack test enviroment

FROM ubuntu:latest

WORKDIR /
COPY . /

RUN apt-get update
RUN apt-get install fish -y
RUN apt-get install curl -y
RUN curl -sL https://deb.nodesource.com/setup_6.x | bash - && apt-get install nodejs -y
RUN npm install webpack -g
RUN npm install
RUN npm run build
#RUN npm run webpack-dev-server prøver med cmd i stedet
CMD npm run webpack-dev-server

但是当我跑docker run -p 1384:1483 epdspa时,我得到了:

> epd-portal-spa@1.0.0 webpack-dev-server /
> webpack-dev-server --open --inline

Project is running at http://localhost:1384/
webpack output is served from /
Content not from webpack is served from ./public/
Hash: 80935d7e0983c2034300
Version: webpack 3.8.1
Time: 9870ms

我还从本地计算机上的终端窗口运行以下命令:

curl localhost:1384

为什么只有curl: (56) Recv failure: Connection reset by peer 版本我不确定,

netstat -pnlt | grep :1384


tcp6       0      0 :::1384                 :::*                    LISTEN      - 

有关docker网络配置的更多信息:

Ipv6

我很确定docker CLI中有一些[OPTIONS],[COMMAND]或[ARG ..]可以使用,但我似乎无法从文档中找到它。

1 个答案:

答案 0 :(得分:0)

我通过使用以下dockerfile将图像从ubuntu更改为nginx解决了我的问题:

FROM kyma/docker-nginx
RUN apt-get update

# Add src.
COPY public/ /var/www

CMD 'nginx'

正在运行:docker run -p 1384:80 -d epdspa正常运行