title: Trying to use Docker for the first time: Error response from daemon: driver failed programming external connectivity on endpoint webserver (2d9
body: <p>I am trying to build a Flask/PostgreSQL/SQLAlchemy/Alembic/libpq-dev/psycopg2 web app on macOS. 
  I have never used Docker so I thought I'd give it a try. I installed it and was going through the Get Started steps. </p>
  
  <pre><code>$ docker --version
  Docker version 18.06.0-ce, build 0ffa825
  
  $ docker-compose --version
  docker-compose version 1.22.0, build f46880f
  
  $ docker-machine --version
  docker-machine version 0.15.0, build b48dc28d
  </code></pre>
  
  <p>Then I went to step two:</p>
  
  <pre><code>$ docker run hello-world
  
  Hello from Docker!
  This message shows that your installation appears to be working correctly.
  
  To generate this message, Docker took the following steps:
   1. The Docker client contacted the Docker daemon.
   2. The Docker daemon pulled the "hello-world" image from the Docker Hub.
      (amd64)
   3. The Docker daemon created a new container from that image which runs the
      executable that produces the output you are currently reading.
   4. The Docker daemon streamed that output to the Docker client, which sent it
      to your terminal.
  
  To try something more ambitious, you can run an Ubuntu container with:
   $ docker run -it ubuntu bash
  
  Share images, automate workflows, and more with a free Docker ID:
   https://hub.docker.com/
  
  For more examples and ideas, visit:
   https://docs.docker.com/engine/userguide/
  </code></pre>
  
  <p>Everything was working just like the documentation, but then I tried the next step, "starting a dockerized web server," and this is what happened...</p>
  
  <pre><code>$ docker run -d -p 80:80 --name webserver nginx
  159841d356d8cf6b16fd592b22daa76f3a734a8b35bf24f9f83b3dce6486d49e
  docker: Error response from daemon: driver failed programming external connectivity on endpoint webserver (2d93210e398bf70794b706d6e07ca2c2b78297b9f337271710f4c62be8a79b7d): Error starting userland proxy: Bind for 0.0.0.0:80: unexpected error (Failure EADDRINUSE).
  </code></pre>
  
  <p>So, I googled the error and have found numerous instances of this or similar errors on forums like github and stackoverflow. I tried all of the steps to resolve it that I could find. </p>
  
  <pre><code>sudo netstat -nl -p tcp  | grep 8123
  Password:
  
  MyMacName@My-MacBook-Pro ~
  $ sudo netstat -nl -p tcp  | head
  Active Internet connections
  Proto Recv-Q Send-Q  Local Address          Foreign Address        (state)
  tcp4       0      0  10.0.0.94.49655        54.174.175.30.443      ESTABLISHED
  tcp4       0      0  10.0.0.94.49654        192.30.253.117.443     ESTABLISHED
  tcp4       0      0  10.0.0.94.49653        50.16.137.101.443      ESTABLISHED
  tcp4       0      0  10.0.0.94.49652        192.30.253.125.443     ESTABLISHED
  tcp4       0      0  10.0.0.94.49651        151.101.4.133.443      ESTABLISHED
  tcp4       0      0  10.0.0.94.49650        151.101.4.133.443      ESTABLISHED
  tcp4       0      0  10.0.0.94.49649        151.101.56.133.443     ESTABLISHED
  tcp4       0      0  10.0.0.94.49648        34.238.78.202.443      ESTABLISHED
  </code></pre>
  
  <p>but I don't know what to make of any of this so it doesn't do me any good on it's own. So I found these steps and tried them...</p>
  
  <pre><code>$ docker stop $(docker ps -a -q)
  2eb7a75a5fd7
  
  $ docker rm $(docker ps -a -q);
  2eb7a75a5fd7
  
  $ docker volume rm $(docker volume ls -qf dangling=true)
  "docker volume rm" requires at least 1 argument.
  See 'docker volume rm --help'.
  
  Usage:  docker volume rm [OPTIONS] VOLUME [VOLUME...]
  
  Remove one or more volumes
  
  $ docker network rm $(docker network ls -q)
  Error response from daemon: bridge is a pre-defined network and cannot be removed
  Error response from daemon: host is a pre-defined network and cannot be removed
  Error response from daemon: none is a pre-defined network and cannot be removed
  
  $ sudo lsof -nP | grep LISTEN
  Password:
  
  httpd        97               root    4u     IPv6 0xb250f70d0ca8909d         0t0        TCP *:80 (LISTEN)
  mysqld      113             _mysql   19u     IPv6 0xb250f70d0ca8a1dd         0t0        TCP *:3306 (LISTEN)
  mysqld      113             _mysql   22u     IPv6 0xb250f70d0ca8a79d         0t0        TCP *:33060 (LISTEN)
  awacsd      215               root    8u     IPv6 0xb250f70d0ca8b31d         0t0        TCP [fd24:e01e:118f:e97:75e1:c8cf:5efb:c34c]:4488 (LISTEN)
  httpd       234     MyMacName    4u     IPv6 0xb250f70d0ca8909d         0t0        TCP *:80 (LISTEN)
  httpd       235     MyMacName    4u     IPv6 0xb250f70d0ca8909d         0t0        TCP *:80 (LISTEN)
  httpd       236     MyMacName    4u     IPv6 0xb250f70d0ca8909d         0t0        TCP *:80 (LISTEN)
  httpd       237     MyMacName    4u     IPv6 0xb250f70d0ca8909d         0t0        TCP *:80 (LISTEN)
  httpd       238     MyMacName    4u     IPv6 0xb250f70d0ca8909d         0t0        TCP *:80 (LISTEN)
  rapportd    402     MyMacName    3u     IPv4 0xb250f70d1db86225         0t0        TCP *:58588 (LISTEN)
  rapportd    402     MyMacName    4u     IPv6 0xb250f70d0ca8851d         0t0        TCP *:58588 (LISTEN)
  postgres    441     MyMacName    5u     IPv6 0xb250f70d0ca8965d         0t0        TCP [::1]:5432 (LISTEN)
  postgres    441     MyMacName    6u     IPv6 0xb250f70d0ca8ad5d         0t0        TCP [fe80:1::1]:5432 (LISTEN)
  postgres    441     MyMacName    7u     IPv4 0xb250f70d0cf3db85         0t0        TCP 127.0.0.1:5432 (LISTEN)
  Adobe\x20   567     MyMacName   13u     IPv4 0xb250f70d1335fe45         0t0        TCP 127.0.0.1:15292 (LISTEN)
  Adobe\x20   567     MyMacName  31u     IPv4 0xb250f70d0ecd1225         0t0        TCP 127.0.0.1:15393 (LISTEN)
  httpd       744     MyMacName    4u     IPv6 0xb250f70d0ca8909d         0t0        TCP *:80 (LISTEN)
  node        746     MyMacName   15u     IPv4 0xb250f70d0e5be225         0t0        TCP 127.0.0.1:49255 (LISTEN)
  httpd       748     MyMacName    4u     IPv6 0xb250f70d0ca8909d         0t0        TCP *:80 (LISTEN)
  httpd       749     MyMacName   4u     IPv6 0xb250f70d0ca8909d         0t0        TCP *:80 (LISTEN)
  cupsd      3415               root    5u     IPv6 0xb250f70d13944e9d         0t0        TCP [::1]:631 (LISTEN)
  cupsd      3415               root    6u     IPv4 0xb250f70d16c228c5         0t0        TCP 127.0.0.1:631 (LISTEN)
  pgAdmin4   4253     MyMacName  14u     IPv4 0xb250f70d0e7638c5         0t0        TCP 127.0.0.1:54792 (LISTEN)
  </code></pre>
  
  <p>Unfortunately, I do not know what any of this means either. I thought the problem may have been that the last line shows PostgreSQL's PgAdmin4 is running. So went into Utility Monitor and Force Quit that. There were still 5-6 instances of 'postgres' that I could not get to force quit for some reason. It must be something to do with my Mac coming with postgres of some kind. </p>
  
  <p>Does anything I've pasted here help someone who knows Docker diagnose what I can do to move past this?</p>