I have successfully built and started the docker container, it is running perfectly, but when I try to access it [ End point url 0.0.0.0:6001
] I am getting a "socket hang up" error
GET http://0.0.0.0:6001/
Error: socket hang up
Request Headers
User-Agent: PostmanRuntime/7.26.8
Accept: */*
Postman-Token: <token>
Host: 0.0.0.0:6001
Accept-Encoding: gzip, deflate, br
Connection: keep-alive
Earlier it was working fine but when I removed the containers and images and rebuild it then I started getting this error
I am using Postman
to make GET
request and I also tried Web browser
Can anyone tell me whats the problem
--Update--
Creating containers
# Create Virtual Network
$ sudo docker network create network1
# Using custom network as there are multiple containers
# which communicate with each other
# Create Containers
$ sudo docker build -t form_ocr:latest .
$ sudo docker run -d -p 6001:5000 --net network1 --name form_ocr form_ocr
netstat
command output
$ netstat -nltp
...
tcp6 0 0 :::6001 :::* LISTEN -
docker container inspect
output
$ sudo docker container inspect <container-id>
docker ps
output
$ sudo docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
835e8cb11eee form_ocr "python3 app.py" 16 hours ago Up 40 seconds 0.0.0.0:6001->5000/tcp form_ocr
Just add this in main.ts, where you listen to the port:
await app.listen(6001, '0.0.0.0', () => console.log(`Listening on port: 6000`));
Add the '0.0.0.0', it should work.
I had the same problem with fastapi container
Make sure your app is listening on 0.0.0.0 within the container
Try localhost:6001 not internet address
You can also try any of your system local ipaddress, you find ipaddress by typing ifconfig or ipconfig if you are in linux or windows respectively
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.