Øystein Seel
Øystein Seel

Reputation: 935

Localhost connection reset by peer, docker container(ubuntu) running angularjs webpack app

I am running my webapp within a ubuntu container, with the following dockerfile:

# 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

I start the app app with docker run -p 1384:1483 epdspa which returns:

> [email protected] 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

But when i run curl localhost:1384 i get:

curl: (56) Recv failure: Connection reset by peer

I also run the following commands from a terminal window on my local machine:

netstat -pnlt | grep :1384


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

Why there is only a Ipv6 version I'm not sure,

route 
172.17.0.0      0.0.0.0         255.255.0.0     U     0      0        0 docker0

More info about the docker network configuration:

'[
    {
        "Name": "bridge",
        "Id": "d7c753e63270be9aae2af38ab1044966c066ad6e69fec0f95e28c7e3c850ff23",
        "Created": "2017-12-01T08:08:51.677254348+01:00",
        "Scope": "local",
        "Driver": "bridge",
        "EnableIPv6": false,
        "IPAM": {
            "Driver": "default",
            "Options": null,
            "Config": [
                {
                    "Subnet": "172.17.0.0/16",
                    "Gateway": "172.17.0.1"
                }
            ]
        },
        "Internal": false,
        "Attachable": false,
        "Ingress": false,
        "ConfigFrom": {
            "Network": ""
        },
        "ConfigOnly": false,
        "Containers": {
            "21bcc48764a7245a5f8ef851e3e16774e91d0447fac6fc614089b5b917b71b31": {
                "Name": "angry_bassi",
                "EndpointID": "c744a2a7f2596d743ed91756f846d455967bb634292190c69789b447cca5ca2d",
                "MacAddress": "02:42:ac:11:00:02",
                "IPv4Address": "172.17.0.2/16",
                "IPv6Address": ""
            }
        },
        "Options": {
            "com.docker.network.bridge.default_bridge": "true",
            "com.docker.network.bridge.enable_icc": "true",
            "com.docker.network.bridge.enable_ip_masquerade": "true",
            "com.docker.network.bridge.host_binding_ipv4": "0.0.0.0",
            "com.docker.network.bridge.name": "docker0",
            "com.docker.network.driver.mtu": "1500"
        },
        "Labels": {}
    }
]

I'm pretty sure there are some [OPTIONS], [COMMAND] or [ARG..] in the docker CLI that will work, but I can't seem to figure it out from the documenation.

Upvotes: 0

Views: 1610

Answers (1)

Øystein Seel
Øystein Seel

Reputation: 935

I solved my issue by changing the image from ubuntu to nginx with the following dockerfile:

FROM kyma/docker-nginx
RUN apt-get update

# Add src.
COPY public/ /var/www

CMD 'nginx'

running: docker run -p 1384:80 -d epdspa works fine

Upvotes: 1

Related Questions