Docker Community Forums

Share and learn in the Docker community.

Run docker engine with 443 port already occupied

docker

(Mbortola) #1

Hi all

I need to run docker engine on my ubuntu host, but also i need to run an https apache server into it, as consequence, starting docker as second service, i will get 443 port as occupied. Can i use another port for docker instead of 443? Thanks


(Jeff Anderson) #2

By default, docker does not listen on port 443.

Do you have a container that is published to port 443? What is the output of docker ps ? If you have a container published to port 443, then you can stop/remove it.


(Dvohra) #3

Docker Engine runs as a process. The Docker containers expose port/s, which are specified in the Dockerfile such as EXPOSE 80, or in the docker run command with -p


(Mbortola) #4

Thanks for the answers,

I am not talking about containers, I am talking about the daemon, with my apache https server up and running when I start the daemon it finds the 443 port occupied.


(Dvohra) #5

Are Docker Trusted Registry and Docker UCP also used? If so, both of those trying to start on the same default port 443 would cause the error. Start UCP on a different port such as 8443 with --controller-port option.


(Dvohra) #6

"Additionally, your host needs to have TCP ports 80 and 443 available for the Docker Trusted Registry container port mapping."
https://docs.docker.com/docker-trusted-registry/install/install-dtr/

Docker UCP Master also makes use port 443.

With both Docker Trusted Registry and Docker UCP making use of port 443 an error is generated.


(Mbortola) #7

Thanks, for the answrs.

When i start docker daemon by hand with my https apache webserver already up i will get this warning

INFO[0013] IPv6 enabled; Adding default IPv6 external servers : [nameserver 2001:4860:4860::8888 nameserver 2001:4860:4860::8844]
WARN[0013] Failed to allocate and map port 443-443: Error starting userland proxy: listen tcp 0.0.0.0:443: bind: address already in use

It means that 44 is already occupied


(Dvohra) #8

Run the following command to find network processes running and the ports. What is the output?
netstat -tulpn


(Mbortola) #9

sudo netstat -tulpn | grep 443
tcp6 0 0 :::443 :::* LISTEN 9689/apache2

of course, with my https apache up docker cannot bin 443 port, any option to tell docker to use another port in substitution to 443?

Thanks


(Jeff Anderson) #10

When you launch your docker container, publish the port to something other than port 443: docker run -p 1443:443 ...

You’ll probably have to do the following:

  1. stop apache
  2. start docker
  3. remove the container that is currently published to port 443
  4. start apache
  5. start a new container that takes place of the one that you removed, but publish to a port other than 443.

(Mbortola) #11

Sorry but i am not talking about docker container, i am talking about docker daemon/engine


(Dvohra) #12

Is the Docker Engine running? What is the OS and how is Docker Engine installed? What is the output of
service docker start
service docker status

As mentioned before the Docker Engine itself does not run on a port. As indicated by the command output apache2 is running on 443. Could it be apache2 is getting started again.


(Mbortola) #13

Shutting down the https apache and starting docker i see that apache
finds 44 port occupied, so makinga a

sudo netstat -tulpn | grep 443

i see that

tcp6 0 0 :::443 :::* LISTEN
7027/docker-proxy

what is docker proxy? and why it uses my 443 port, ‘docker ps’ doesn’t
show any running container

Tnaks


(Alex Wellock) #14

@mbortola The docker proxy is not a container so it will not show up when running ‘docker ps’. The docker proxy, from my understanding, is what allows docker to map a host port to a port in a container.
You mentioned that you start the docker daemon by hand. Can you provided the command that you use.


(Dvohra) #15

Start Docker without the proxy. The port 443 won’t get used.


(Mbortola) #16

i saw that a container (discourse) automatically started using 443 port even if i shutted down the engine or other. Now everything seems ok.

Thanks.


(Dvohra) #17

Is Docker registry running, which would use port 443.


(Paulo Figueiredo) #18

Hi! :slight_smile:
How have you solved this?

tnks


(Mbortola) #19

It was a problem related to an automated startup container.

It was a container that started automatically and occupies the 443 port, so a container that needs a 443 port crashes because it founds it occupied.