I managed to set up ghost blog on my raspberry pi.I was able to access the index page on curl without issues. But I had to restart my container. After restarting the container, I cannot access the site anymore.
I get the following error when I run the command
curl http://localhost:4500
curl: (56) Recv failure: Connection reset by peer
If I spin up a new container it works fine. How can I rectify the above error?
I managed to isolate the issue. It's seems to be an issue with ip binding but am unsure how to reolve it.
Docker Rails app fails to be served - curl: (56) Recv failure: Connection reset by peer
As suggested in the above question, I tried curl inside the container and it works. I also tried from the host using the container ip and that works as well. It fails when i curl usint localhost:portnumber.
Related
I have a .NET 6 web API which says this:
Now listening on: http://[::]:80
It is inside a docker container based on mcr.microsoft.com/dotnet/aspnet:6.0 and with this:
docker run -p 4300:80 ...
I get normal responses from within the docker container if I do this:
docker exec -it acs curl http://localhost:80
But I can't connect to it from the localhost. If I try this...
curl http://localhost:4300
... then I get a timeout after about 20 seconds:
curl: (28) Failed to connect to localhost port 4300 after 21031 ms: Timed out
I get the same error message if I try curl on an IP port where nobody is listening (e.g. 4301) but then it only takes 5 seconds, which leads me to suppose that something in the .NET stack is refusing the connection.
How do I get this to work?
I am dockerized a golang application and i am trying to access the application. Application running in port 8007
I am running the container the following command
docker run --name sample_go_app -p 7000:8007 sample_go
After tried curl http://localhost:7000 but getting error
curl: (56) Recv failure: Connection reset by peer
main.go
...
srv := &http.Server {
Handler: router,
Addr: "localhost:8007",
}
...
You're binding the socket to localhost address which cannot be reached from outside of your container. You should only add the port part in the address so that your process accepts connection from any network interface. You can define your server this way:
srv := &http.Server {
Handler: router,
Addr: ":8007",
}
So, I have minikube 0.16.0 installed
Also istio 1.7.3
So I do envoy sidecars on each deployment I do, as per with command kubectl label namespace default istio-injection=enabled
Now, coming to the question, I'm not able to do any curl from inside any pod whatsoever, even from sleep-diag, I always get request timed out message, but it does work for non secure http
For example while installing jenkins, I try to curl against this url with no success:
bash-5.0# curl -v https://updates.jenkins.io/current/update-center.json
* Trying 92.242.132.16:443...
* TCP_NODELAY set
* connect to 92.242.132.16 port 443 failed: Operation timed out
* Failed to connect to updates.jenkins.io port 443: Operation timed out
* Closing connection 0
curl: (28) Failed to connect to updates.jenkins.io port 443: Operation timed out
But even if I try let's say:
bash-5.0# curl -v https://www.google.com
* Trying 92.242.132.16:443...
* TCP_NODELAY set
* connect to 92.242.132.16 port 443 failed: Operation timed out
* Failed to connect to www.google.com port 443: Operation timed out
* Closing connection 0
curl: (28) Failed to connect to www.google.com port 443: Operation timed out
While I'm able to outside of any pod in my local cluster, any ideas on this?
For example, tried installing jenkins like this, with helm:
helm install --set Master.ServiceType=ClusterIP jenkins/jenkins --generate-name
Obviously it will fail because I cannot access any https from my local cluster, even specifying NodePort I have the same issue:
helm install --set Master.ServiceType=NodePort jenkins/jenkins --generate-name
Any ideas?
I am trying to run a Go app binary in a docker container. The app has some gRPC request being listen and server on:
http.ListenAndServe("localhost:8081", nil)
In my docker-compose.yaml. I have a service of the app mapped to 8081:
golangAPP:
build:
context: .
dockerfile: ./docker/golangAPP/Dockerfile
depends_on:
- setup
ports:
- 8081:8081
After docker-compose up I can see the verbose that the app is being served.
But I still cannot reach it. curl -X OPTIONS http://localhost:8081 return
curl: (56) Recv failure: Connection reset by peer
If I run the binary locally without docker, then I can send request to the app.
Any suggestion? I did some googling and some point to firewall issue. But I am not sure how to proceed.
If you do:
http.ListenAndServe("localhost:8081", nil)
this will listen to connections from the loopback interface. When running within a container, this will only accept connections coming from within that container (or if you're running this in a k8s pod, within the same pod). So:
http.ListenAndServe(":8081", nil)
This will accept both loopback and external connections (external to the container).
I know this error has been posted before on StackOverflow and many solutions/answers are available too. But, I've already gone through all those answers and couldn't find any viable solution for me.
I'm running a Hyperledger Fabric network with single peer and orderer. Their Docker containers have exposed the following ports. 7051:7051 & 7053:7053 on peer, 7050:7050 on orderer. I'm trying to configure Prometheus to analyse the metrics by following the official documentation .
As mentioned in the documentation, I'm exposing my local machine's 9443 port to port 9443 of peer docker container by mapping it as 9443:9443 in ports section of docker-compose.yaml. When I run curl 0.0.0.0:9443, I get curl: (56) Recv failure: Connection reset by peer error.
However, when I run the command curl 0.0.0.0:9443/logspec in my peer container I get the desired result which is {"spec":"info"}. The two commands mentioned above are different but I've also tried running the command curl 0.0.0.0:9443/logspec in my local machine to which I got the same error response.
Running the command curl -v 0.0.0.0:9443 results in following response.
* About to connect() to 0.0.0.0 port 9443 (#0)
* Trying 0.0.0.0...
* Connected to 0.0.0.0 (0.0.0.0) port 9443 (#0)
> GET / HTTP/1.1
> User-Agent: curl/7.29.0
> Host: 0.0.0.0:9443
> Accept: */*
>
* Recv failure: Connection reset by peer
* Closing connection 0
curl: (56) Recv failure: Connection reset by peer
I read in many of the answers that I might be a firewall issue. But even after disabling my firewall using the command systemctl disable firewalld, it's not working.
cat etc/os-release response
NAME="CentOS Linux"
VERSION="7 (Core)"
ID="centos"
ID_LIKE="rhel fedora"
VERSION_ID="7"
PRETTY_NAME="CentOS Linux 7 (Core)"
CPE_NAME="cpe:/o:centos:centos:7"
HOME_URL="https://www.centos.org/"
BUG_REPORT_URL="https://bugs.centos.org/"
CENTOS_MANTISBT_PROJECT="CentOS-7"
CENTOS_MANTISBT_PROJECT_VERSION="7"
REDHAT_SUPPORT_PRODUCT="centos"
REDHAT_SUPPORT_PRODUCT_VERSION="7"
curl --version response
curl 7.29.0 (x86_64-redhat-linux-gnu) libcurl/7.29.0 NSS/3.34 zlib/1.2.7 libidn/1.28 libssh2/1.4.3
I request you not to mark this question as duplicate as I've already gone through all the possible scenarios mentioned here.
First of all please check if there is firewall. Disable it.
Then remove the IP address provided in core.yaml file in operations tab. So that line will look like a below:
operations:
# host and port for the operations server
listenAddress: :9443
This change worked for me.