我收到错误绑定:jwilder/nginx-proxy 下的 运行 Laravel 应用已使用地址

I got error bind: address already in use with running Laravel app under jwilder/nginx-proxy

尝试 运行 docker laravel 基于 jwilder/nginx-proxy 的项目我遇到错误:

 bind: address already in use

我一开始尝试停止 docker 并在我的托管 Kubuntu 18 上停止 apache,但仍然出错:

user@HostingOS:/ProjectPath/lml$ systemctl stop docker
user@HostingOS:/ProjectPath/lml$ systemctl restart docker
user@HostingOS:/ProjectPath/lml$ docker-compose down
Removing php-projectname   ... done
Removing mysql-projectname ... done
Removing php-userend       ... done
Removing nginx-projectname ... done
Removing php-radius        ... done
Removing network lml_default
user@HostingOS:/ProjectPath/lml$ netstat -lpn | grep 8089
(Not all processes could be identified, non-owned process info
 will not be shown, you would have to be root to see it all.)
user@HostingOS:/ProjectPath/lml$ docker-compose up
Creating network "lml_default" with the default driver
Creating mysql-projectname ...
Creating php-radius ...
Creating nginx-projectname ...
Creating php-userend ...
Creating mysql-projectname
Creating nginx-projectname
Creating php-radius
Creating mysql-projectname ... error

ERROR: for mysql-projectname  Cannot start service mysql: driver failed programming external connectivity on endpoint mysql-projectname (3ef3ad98ea6a0bfcf07b2ff822b9804acbdc630d2e0dd1e6827878ddca818a20): Error startCreating php-radius ... done
Creating php-projectname ...
Creating php-projectname ... done

ERROR: for mysql  Cannot start service mysql: driver failed programming external connectivity on endpoint mysql-projectname (3ef3ad98ea6a0bfcf07b2ff822b9804acbdc630d2e0dd1e6827878ddca818a20): Error starting userland proxy: listen tcp 0.0.0.0:3306: bind: address already in use
ERROR: Encountered errors while bringing up the project.
user@HostingOS:/ProjectPath/lml$ curl -H "Host: whoami.local" localhost
<html>
<head><title>503 Service Temporarily Unavailable</title></head>
<body>
<center><h1>503 Service Temporarily Unavailable</h1></center>
<hr><center>nginx/1.21.1</center>
</body>
</html>

docker-compose.yml :

version: '2'

services:
  nginx: # NGINX-PROXY
    image: 'jwilder/nginx-proxy:latest'
    container_name: 'nginx-projectname'
    ports:
      - '80:80'
    volumes:
      - /etc/localtime:/etc/localtime:ro
      - /var/run/docker.sock:/tmp/docker.sock
      - ./docker/nginx.tmpl:/app/nginx.tmpl
      - .:/var/www/html

  # PHP7-alpine fpm
  php:
    container_name: 'php-projectname'
    image: 'roneichiarandi/php71-alpine'
    ports:
      - "9000"
    volumes:
      - /etc/localtime:/etc/localtime:ro
      - .:/var/www/html
      - ./logs:/tmp/logs
    environment:
      - VIRTUAL_HOST=projectname.dev
      - VIRTUAL_PORT=
      - PHP_FPM=1
    links:
      - 'radius'
    extra_hosts:
      - "radius.dev:172.18.0.1"

  # PHP7-alpine fpm
  userend:
    container_name: 'php-userend'
    # image: 'matriphe/alpine-php:fpm-5.6'
    image: 'roneichiarandi/php71-alpine'
    ports:
      - "9000"
    volumes:
      - /etc/localtime:/etc/localtime:ro
      - ../userend:/var/www/html
      - ../userend/logs:/tmp/logs
    environment:
      - VIRTUAL_HOST=userend.dev
      - VIRTUAL_PORT=
      - PHP_FPM=1

  # PHP7-alpine fpm
  radius:
    container_name: 'php-radius'
    image: 'roneichiarandi/php71-alpine'
    ports:
      - "9000"
    volumes:
      - /etc/localtime:/etc/localtime:ro
      - ../radius:/var/www/html
      - ../radius/logs:/tmp/logs
    environment:
      - VIRTUAL_HOST=radius.dev
      - VIRTUAL_PORT=
      - PHP_FPM=1

  mysql:
    container_name: 'mysql-projectname'
    image: 'mysql:latest'
    ports:
      - "3306:3306"
    volumes:
      - /etc/localtime:/etc/localtime:ro
      - mysqlvolume:/var/lib/mysql
    environment:
      - MYSQL_ROOT_PASSWORD=root
      - MYSQL_DATABASE=projectname

volumes:
    mysqlvolume:

我检查我的 OS:

user@HostingOS:/ProjectPath/lml$ docker info
Client:
 Context:    default
 Debug Mode: false
 Plugins:
  app: Docker App (Docker Inc., v0.9.1-beta3)
  buildx: Build with BuildKit (Docker Inc., v0.5.1-docker)

Server:
 Containers: 9
  Running: 5
  Paused: 0
  Stopped: 4
 Images: 5
 Server Version: 19.03.13
 Storage Driver: overlay2
  Backing Filesystem: extfs
  Supports d_type: true
  Native Overlay Diff: true
 Logging Driver: json-file
 Cgroup Driver: cgroupfs
 Plugins:
  Volume: local
  Network: bridge host ipvlan macvlan null overlay
  Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog
 Swarm: inactive
 Runtimes: runc
 Default Runtime: runc
 Init Binary: docker-init
 containerd version: d71fcd7d8303cbf684402823e425e9dd2e99285d
 runc version: b9ee9c6314599f1b4a7f497e1f1f856fe433d3b7
 init version: fec3683
 Security Options:
  apparmor
  seccomp
   Profile: default
 Kernel Version: 4.15.0-128-generic
 Operating System: Ubuntu 18.04.5 LTS
 OSType: linux
 Architecture: x86_64
 CPUs: 4
 Total Memory: 7.711GiB
 Name: AtHome
 ID: FGEV:TTKB:COS7:VUEW:7C2T:UJWK:2L66:Y6UE:APLU:M5HG:R5DG:3RN7
 Docker Root Dir: /var/lib/docker
 Debug Mode: false
 Registry: https://index.docker.io/v1/
 Labels:
 Experimental: false
 Insecure Registries:
  127.0.0.0/8
 Live Restore Enabled: false

WARNING: No swap limit support
user@HostingOS:/ProjectPath/lml$ docker images
REPOSITORY                    TAG       IMAGE ID       CREATED         SIZE
jwilder/nginx-proxy           latest    f8a3628ba78f   2 days ago      149MB
mysql                         latest    5a4e492065c7   2 weeks ago     514MB
adminer                       latest    d17a5619198d   8 months ago    89.9MB
mysql                         5.7.28    db39680b63ac   20 months ago   437MB
roneichiarandi/php71-alpine   latest    1cba845364b9   4 years ago     71.4MB
user@HostingOS:/ProjectPath/lml$ docker stats



CONTAINER ID   NAME                  CPU %     MEM USAGE / LIMIT     MEM %     NET I/O         BLOCK I/O         PIDS
2ae0dc0d4363   php-projectname       0.01%     19.47MiB / 7.711GiB   0.25%     12.9kB / 0B     24.6kB / 188kB    4
681588bfa6b3   nginx-projectname     0.18%     38.16MiB / 7.711GiB   0.48%     13.9kB / 730B   22.2MB / 4.1kB    25
de0578423225   php-radius            0.00%     24.75MiB / 7.711GiB   0.31%     16kB / 0B       14.4MB / 57.3kB   4
e7159a933104   php-userend           0.00%     19.89MiB / 7.711GiB   0.25%     14.1kB / 0B     77.8kB / 0B       4
e5dddc493fe2   gotoconsult_adminer   0.00%     4.395MiB / 7.711GiB   0.06%     16.6kB / 0B     2.08MB / 0B       1
0c6a52f43a8b   gotoconsult_db        0.00%     0B / 0B               0.00%     0B / 0B         0B / 0B           0
^C
user@HostingOS:/ProjectPath/lml$ docker ps -a
CONTAINER ID   IMAGE                         COMMAND                  CREATED          STATUS                         PORTS                     NAMES
2ae0dc0d4363   roneichiarandi/php71-alpine   "/entrypoint.sh php-…"   3 minutes ago    Up 3 minutes                   0.0.0.0:32770->9000/tcp   php-projectname
681588bfa6b3   jwilder/nginx-proxy:latest    "/app/docker-entrypo…"   3 minutes ago    Up 3 minutes                   0.0.0.0:80->80/tcp        nginx-projectname
de0578423225   roneichiarandi/php71-alpine   "/entrypoint.sh php-…"   3 minutes ago    Up 3 minutes                   0.0.0.0:32768->9000/tcp   php-radius
89c2afa24b00   mysql:latest                  "docker-entrypoint.s…"   3 minutes ago    Created                                                  mysql-projectname
e7159a933104   roneichiarandi/php71-alpine   "/entrypoint.sh php-…"   3 minutes ago    Up 3 minutes                   0.0.0.0:32769->9000/tcp   php-userend
9b9bf003a1a3   jwilder/nginx-proxy           "/app/docker-entrypo…"   11 minutes ago   Exited (2) 3 minutes ago                                 inspiring_lovelace
05626a8da615   jwilder/nginx-proxy           "/app/docker-entrypo…"   17 minutes ago   Created                                                  adoring_goldwasser
e5dddc493fe2   adminer                       "entrypoint.sh docke…"   8 months ago     Up 3 minutes                   0.0.0.0:8095->8080/tcp    gotoconsult_adminer
0c6a52f43a8b   mysql:5.7.28                  "docker-entrypoint.s…"   8 months ago     Restarting (1) 7 seconds ago

我试图释放我之前的 gotoconsult 项目,但不知道如何修复这个错误?

谢谢!

运行 命令

netstat -lpn | grep 3306

在 sudo 下显示 mysql 监听 3306 端口, 所以停止 OS 的 mysql 帮助我 运行 docker 没有错误。