Reputation: 11
I have recently created a droplet on DigitalOcean and installed Docker on the server. I ran
docker container run -d -p 8080:80 nginx
on the server. This command runs perfectly, as checked by docker ps
command.
But how do I access the localhost:8080
on DigitalOcean server as localhost:8080
on my machine doesn't work?
Upvotes: 1
Views: 2162
Reputation: 11
When you try to access it by localhost:8080 on your local machine, it will search your local machine. It's a loopback destination, you may know it by 127.0.0.1
If you want to access you digitalocean droplet on your local machine, you can use :8080
Upvotes: 0
Reputation: 693
You need to find out the public IP address or DNS name of your DigitalOcean server. Then use either ipaddress:8080 or dnsname:8080.
localhost refers only to the local machine and is mapped to the 127.0.0.1 IP address. It can only be accessed from the machine itself.
Upvotes: 1