How to fix “curl (56) Recv failure: Connection reset by peer” error when doing a port mapping from docker...
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ height:90px;width:728px;box-sizing:border-box;
}
I have a Angular Project running in a docker container at port 4200. I have done a port mapping from docker container's 4200 port to my localhost 4200.
I am running this on Ubuntu 16.04. When doing netstat -nltp
, I get output
tcp6 0 0 :::4200 :::* LISTEN
My Dockerfile looks like :
FROM node
RUN mkdir -p /usr/src/app
WORKDIR /usr/src/app
COPY package.json /usr/src/app
RUN npm cache clean --force
RUN npm install
COPY . /usr/src/app
EXPOSE 4200
CMD ["npm","start"]
I expected when running curl :::4200, to show me the webpage sourcecode instead of the error,
curl (56) Recv failure: Connection reset by peer
linux docker docker-compose containers port
add a comment |
I have a Angular Project running in a docker container at port 4200. I have done a port mapping from docker container's 4200 port to my localhost 4200.
I am running this on Ubuntu 16.04. When doing netstat -nltp
, I get output
tcp6 0 0 :::4200 :::* LISTEN
My Dockerfile looks like :
FROM node
RUN mkdir -p /usr/src/app
WORKDIR /usr/src/app
COPY package.json /usr/src/app
RUN npm cache clean --force
RUN npm install
COPY . /usr/src/app
EXPOSE 4200
CMD ["npm","start"]
I expected when running curl :::4200, to show me the webpage sourcecode instead of the error,
curl (56) Recv failure: Connection reset by peer
linux docker docker-compose containers port
How do you run the container?Launching your app from browser works?
– leopal
Jan 4 at 10:56
And does the Node process actually listen on port 4200? (Express's default is often 3000; the EXPOSE directive and the right-hand side ofdocker run -p
need to match the internal port number.)
– David Maze
Jan 4 at 12:06
@leopal Yes, the app works just fine!
– ksmaurya
Jan 10 at 5:56
@DavidMaze Yes, the node process is listening to port 400. I have a Dockerfile defined which port maps it from 4200:42000.
– ksmaurya
Jan 10 at 5:57
add a comment |
I have a Angular Project running in a docker container at port 4200. I have done a port mapping from docker container's 4200 port to my localhost 4200.
I am running this on Ubuntu 16.04. When doing netstat -nltp
, I get output
tcp6 0 0 :::4200 :::* LISTEN
My Dockerfile looks like :
FROM node
RUN mkdir -p /usr/src/app
WORKDIR /usr/src/app
COPY package.json /usr/src/app
RUN npm cache clean --force
RUN npm install
COPY . /usr/src/app
EXPOSE 4200
CMD ["npm","start"]
I expected when running curl :::4200, to show me the webpage sourcecode instead of the error,
curl (56) Recv failure: Connection reset by peer
linux docker docker-compose containers port
I have a Angular Project running in a docker container at port 4200. I have done a port mapping from docker container's 4200 port to my localhost 4200.
I am running this on Ubuntu 16.04. When doing netstat -nltp
, I get output
tcp6 0 0 :::4200 :::* LISTEN
My Dockerfile looks like :
FROM node
RUN mkdir -p /usr/src/app
WORKDIR /usr/src/app
COPY package.json /usr/src/app
RUN npm cache clean --force
RUN npm install
COPY . /usr/src/app
EXPOSE 4200
CMD ["npm","start"]
I expected when running curl :::4200, to show me the webpage sourcecode instead of the error,
curl (56) Recv failure: Connection reset by peer
linux docker docker-compose containers port
linux docker docker-compose containers port
asked Jan 4 at 10:41
ksmauryaksmaurya
167
167
How do you run the container?Launching your app from browser works?
– leopal
Jan 4 at 10:56
And does the Node process actually listen on port 4200? (Express's default is often 3000; the EXPOSE directive and the right-hand side ofdocker run -p
need to match the internal port number.)
– David Maze
Jan 4 at 12:06
@leopal Yes, the app works just fine!
– ksmaurya
Jan 10 at 5:56
@DavidMaze Yes, the node process is listening to port 400. I have a Dockerfile defined which port maps it from 4200:42000.
– ksmaurya
Jan 10 at 5:57
add a comment |
How do you run the container?Launching your app from browser works?
– leopal
Jan 4 at 10:56
And does the Node process actually listen on port 4200? (Express's default is often 3000; the EXPOSE directive and the right-hand side ofdocker run -p
need to match the internal port number.)
– David Maze
Jan 4 at 12:06
@leopal Yes, the app works just fine!
– ksmaurya
Jan 10 at 5:56
@DavidMaze Yes, the node process is listening to port 400. I have a Dockerfile defined which port maps it from 4200:42000.
– ksmaurya
Jan 10 at 5:57
How do you run the container?Launching your app from browser works?
– leopal
Jan 4 at 10:56
How do you run the container?Launching your app from browser works?
– leopal
Jan 4 at 10:56
And does the Node process actually listen on port 4200? (Express's default is often 3000; the EXPOSE directive and the right-hand side of
docker run -p
need to match the internal port number.)– David Maze
Jan 4 at 12:06
And does the Node process actually listen on port 4200? (Express's default is often 3000; the EXPOSE directive and the right-hand side of
docker run -p
need to match the internal port number.)– David Maze
Jan 4 at 12:06
@leopal Yes, the app works just fine!
– ksmaurya
Jan 10 at 5:56
@leopal Yes, the app works just fine!
– ksmaurya
Jan 10 at 5:56
@DavidMaze Yes, the node process is listening to port 400. I have a Dockerfile defined which port maps it from 4200:42000.
– ksmaurya
Jan 10 at 5:57
@DavidMaze Yes, the node process is listening to port 400. I have a Dockerfile defined which port maps it from 4200:42000.
– ksmaurya
Jan 10 at 5:57
add a comment |
2 Answers
2
active
oldest
votes
Perform a port mapping when running the container for the first time as
docker run -ti --name angular angular_image:latest -p 4200:4200
This will override the EXPOSE command in the dockerfile. In real docker would have allocated a random port mapping from the container to the host machine. So, it is necessary to have a port mapping the docker cli.
I have a docker-compose file which does the same. ` services: angular: build: Client ports: - "4200:4200"`
– ksmaurya
Jan 11 at 5:34
add a comment |
Changing the following in package.json
for my angular project did the trick.
BEFORE
{
"name": "client",
"version": "0.0.0",
"scripts": {
"ng": "ng",
"start": "ng serve",
"build": "ng build",
"test": "ng test",
"lint": "ng lint",
"e2e": "ng e2e"
}
AFTER
{
"name": "client",
"version": "0.0.0",
"scripts": {
"ng": "ng",
"start": "ng serve --host 0.0.0.0",
"build": "ng build",
"test": "ng test",
"lint": "ng lint",
"e2e": "ng e2e"
},
Follow this link for further details
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f54037341%2fhow-to-fix-curl-56-recv-failure-connection-reset-by-peer-error-when-doing-a%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
Perform a port mapping when running the container for the first time as
docker run -ti --name angular angular_image:latest -p 4200:4200
This will override the EXPOSE command in the dockerfile. In real docker would have allocated a random port mapping from the container to the host machine. So, it is necessary to have a port mapping the docker cli.
I have a docker-compose file which does the same. ` services: angular: build: Client ports: - "4200:4200"`
– ksmaurya
Jan 11 at 5:34
add a comment |
Perform a port mapping when running the container for the first time as
docker run -ti --name angular angular_image:latest -p 4200:4200
This will override the EXPOSE command in the dockerfile. In real docker would have allocated a random port mapping from the container to the host machine. So, it is necessary to have a port mapping the docker cli.
I have a docker-compose file which does the same. ` services: angular: build: Client ports: - "4200:4200"`
– ksmaurya
Jan 11 at 5:34
add a comment |
Perform a port mapping when running the container for the first time as
docker run -ti --name angular angular_image:latest -p 4200:4200
This will override the EXPOSE command in the dockerfile. In real docker would have allocated a random port mapping from the container to the host machine. So, it is necessary to have a port mapping the docker cli.
Perform a port mapping when running the container for the first time as
docker run -ti --name angular angular_image:latest -p 4200:4200
This will override the EXPOSE command in the dockerfile. In real docker would have allocated a random port mapping from the container to the host machine. So, it is necessary to have a port mapping the docker cli.
answered Jan 4 at 10:58
Vinod KumarVinod Kumar
599
599
I have a docker-compose file which does the same. ` services: angular: build: Client ports: - "4200:4200"`
– ksmaurya
Jan 11 at 5:34
add a comment |
I have a docker-compose file which does the same. ` services: angular: build: Client ports: - "4200:4200"`
– ksmaurya
Jan 11 at 5:34
I have a docker-compose file which does the same. ` services: angular: build: Client ports: - "4200:4200"`
– ksmaurya
Jan 11 at 5:34
I have a docker-compose file which does the same. ` services: angular: build: Client ports: - "4200:4200"`
– ksmaurya
Jan 11 at 5:34
add a comment |
Changing the following in package.json
for my angular project did the trick.
BEFORE
{
"name": "client",
"version": "0.0.0",
"scripts": {
"ng": "ng",
"start": "ng serve",
"build": "ng build",
"test": "ng test",
"lint": "ng lint",
"e2e": "ng e2e"
}
AFTER
{
"name": "client",
"version": "0.0.0",
"scripts": {
"ng": "ng",
"start": "ng serve --host 0.0.0.0",
"build": "ng build",
"test": "ng test",
"lint": "ng lint",
"e2e": "ng e2e"
},
Follow this link for further details
add a comment |
Changing the following in package.json
for my angular project did the trick.
BEFORE
{
"name": "client",
"version": "0.0.0",
"scripts": {
"ng": "ng",
"start": "ng serve",
"build": "ng build",
"test": "ng test",
"lint": "ng lint",
"e2e": "ng e2e"
}
AFTER
{
"name": "client",
"version": "0.0.0",
"scripts": {
"ng": "ng",
"start": "ng serve --host 0.0.0.0",
"build": "ng build",
"test": "ng test",
"lint": "ng lint",
"e2e": "ng e2e"
},
Follow this link for further details
add a comment |
Changing the following in package.json
for my angular project did the trick.
BEFORE
{
"name": "client",
"version": "0.0.0",
"scripts": {
"ng": "ng",
"start": "ng serve",
"build": "ng build",
"test": "ng test",
"lint": "ng lint",
"e2e": "ng e2e"
}
AFTER
{
"name": "client",
"version": "0.0.0",
"scripts": {
"ng": "ng",
"start": "ng serve --host 0.0.0.0",
"build": "ng build",
"test": "ng test",
"lint": "ng lint",
"e2e": "ng e2e"
},
Follow this link for further details
Changing the following in package.json
for my angular project did the trick.
BEFORE
{
"name": "client",
"version": "0.0.0",
"scripts": {
"ng": "ng",
"start": "ng serve",
"build": "ng build",
"test": "ng test",
"lint": "ng lint",
"e2e": "ng e2e"
}
AFTER
{
"name": "client",
"version": "0.0.0",
"scripts": {
"ng": "ng",
"start": "ng serve --host 0.0.0.0",
"build": "ng build",
"test": "ng test",
"lint": "ng lint",
"e2e": "ng e2e"
},
Follow this link for further details
answered Jan 14 at 11:40
ksmauryaksmaurya
167
167
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f54037341%2fhow-to-fix-curl-56-recv-failure-connection-reset-by-peer-error-when-doing-a%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
How do you run the container?Launching your app from browser works?
– leopal
Jan 4 at 10:56
And does the Node process actually listen on port 4200? (Express's default is often 3000; the EXPOSE directive and the right-hand side of
docker run -p
need to match the internal port number.)– David Maze
Jan 4 at 12:06
@leopal Yes, the app works just fine!
– ksmaurya
Jan 10 at 5:56
@DavidMaze Yes, the node process is listening to port 400. I have a Dockerfile defined which port maps it from 4200:42000.
– ksmaurya
Jan 10 at 5:57