Connection refused on docker container

You need to publish the exposed ports by using the following options:

-P (upper case) or –publish-all that will tell Docker to use random ports from your host and map them to the exposed container’s ports.

-p (lower case) or –publish=[] that will tell Docker to use ports you manually set and map them to the exposed container’s ports.

The second option is preferred because you already know which ports are mapped. If you use the first option then you will need to call docker inspect demo and check which random ports are being used from your host at the Ports section.

Just run the following command:

docker run -it -p 8080:8080 demo

After that your url will work.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)