curl (7): Failed to connect to localhost port 8000: Connection refused
if you are using linux, make sure the server is running using
/etc/init.d/httpd status
Docker: curl: (7) Failed to connect to localhost port 9089: Connection refused
Try below
curl -i -X POST -H "Content-type: application/json" http://localhost: 32768/account/list -d '{"jwt": "jwt_token..."}'
Your docker ps shows
root@Ubuntu1604-001:/home/src/IAM# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
cc28d00d1667 blandry "npm start" 33 minutes ago Up 33 minutes 0.0.0.0:32768->9089/tcp objective_mclean
That means you didn't map 9089
to 9089
. To do that make sure you run your container as
docker run -p 9089:9089 <image>
curl: (7) Failed to connect to localhost port 10001: Connection refused DOCKER
Are you trying to connect inside the container?
If not, you may fight this other unrelated question (covering the outside container case) helpful:
From inside of a Docker container, how do I connect to the localhost of the machine?
curl Failed to connect to localhost port 80
Since you have a ::1 localhost
line in your hosts file, it would seem that curl is attempting to use IPv6 to contact your local web server.
Since the web server is not listening on IPv6, the connection fails.
You could try to use the --ipv4
option to curl
, which should force an IPv4 connection when both are available.
Related Topics
Check If Username and Email Already Exists in Database
What Is the Default Username and Password of Phpmyadmin
How to Throw an Error Message If Username Is Already Registered
Loop Row in Bootstrap Every 3 Columns
Convert Image to Base 64 String With Laravel
How to Get the Values of Input Using PHP
Assign Jquery Value to PHP Variable Inside Ajax Sussess
How to Convert Ereg Expressions to Preg in PHP
How to Enable the Mysqli Extension in PHP 7
Get Selected Option in PHP Without Pressing Submit
Laravel - Getting Current Month and Year Only
Laravel - Form Input - Multiple Select for a One to Many Relationship
Object of Class Mysqli_Result Could Not Be Converted to String