Hello :)
I have a question. Now i created in Droplets new Ubuntu server. and i got a ipv4. I can login through gitlab CI/CD Pipeline with ssh command and i set to run docker container on port 5000. I can see that docker container is running on port 5000 in ubuntu terminal.
But if i try to access in browser with ipv4 it gives ERR_CONNECTION_REFUSED error. i tried to access homepage with http for example http://my-ipv4 and also http://my-ipv4:5000 but both are giving me same error.
Can you help me? :)
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.
Sign up for Infrastructure as a Newsletter.
Working on improving health and education, reducing inequality, and spurring economic growth? We'd like to help.
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Thank you for answering, I will try it as you explained.
Hey there,
In addition to what’s already been mentioned, here are a few things you can check to troubleshoot the
ERR_CONNECTION_REFUSED
error:Make sure your application is bound to the correct IP address and port. This should be set to
0.0.0.0:5000
so that your application can accept connections from any IP address. Check your application’s configuration to make sure this is set correctly.Confirm that your Docker container is running and healthy. You can use the following command to see a list of all running containers:
If your container is not running, you can inspect the logs to see what went wrong:
Check for other services that might conflict with your application. For example, if you have a web server or firewall running on port 5000, this could prevent your application from accepting connections.
Try accessing your server from a different network or using a different browser. This can help rule out browser issues or local network issues.
If your Docker container is running in a custom network mode, make sure that it allows external access. Containers can be set to use bridge, host, or other network modes.
Once you’ve checked all of these things, you should be able to identify the root cause of the error. If you’re still having trouble, please provide more information about your setup and I’ll be happy to offer more specific guidance.
I hope this helps!
Hi there,
There are a few things that I could suggest checking here:
Check if your Docker container is running correctly:
docker exec -it [container_name_or_id] /bin/bash
docker logs [container_name_or_id]
and see if there are any errorsEnsure Docker port binding:
-p
option:docker run -p 5000:5000 your_image_name
.Firewall settings:
First, check the status of
ufw
:If it’s active and port 5000 is not allowed, you’ll need to allow it:
And then reload the firewall:
After going through these steps, try accessing your application again using
http://your_ipv4:5000
.If you still encounter issues, please share any relevant error logs or configurations, and I’ll be happy to assist further!
Best,
Bobby