Docker resolving service NGINX with docker NGINX Docker resolving service NGINX with docker NGINX nginx nginx

Docker resolving service NGINX with docker NGINX


I saw the project you mentioned LaraDock, so I am assuming this is where the Dockerfile and docker-compose.yml came from.


First of all, let's solve the problem, there is 2 information in the error message:

  1. Recreating laradock_nginx_1
  2. listen tcp4 0.0.0.0:443: bind: address already in use

Here is the clue to fix those:

Clean up previous Containers

for fixing Recreating laradock_nginx_1

  1. Make sure the previous Nginx container is clean up, the should be automatically done by the `docker-compose for most cases, but you can always it manually:
    1. make sure the is nothing important inside those containers
    2. docker-compose kill && docker-compose rm

Make sure the target port available

for fixing listen tcp4 0.0.0.0:443: bind: address already in use

There should always be no port problem inside a container, so you have to make check the port on the host machine, run this on your server, and check out which progress has taken the 443 port:

  1. netstat -apn | grep 443
  2. kill that progress if you can

As the change Nginx host port to 8080 part.

Docker uses a Bridge Network by default, Each Container will have its own network namespace, which means every network configuration you modified happened inside the container and has nearly nothing to do with the network on your server.

If you want to change the binding port on your server, you should change the docker-compose.yml, for example, here, this will make docker-compose binding the port inside your Nginx container to a new one on your server