Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multiple ambiguous docker networks created #5193

Closed
1 task done
pbowyer opened this issue Jul 25, 2023 · 63 comments
Closed
1 task done

Multiple ambiguous docker networks created #5193

pbowyer opened this issue Jul 25, 2023 · 63 comments

Comments

@pbowyer
Copy link

pbowyer commented Jul 25, 2023

Is there an existing issue for this?

  • I have searched the existing issues

Output of ddev debug test

Expand `ddev debug test` diagnostic information
Running bash [-c /var/folders/1m/cv08gd016zs66h2p26szn0840000gn/T/test_ddev.sh]
======= Existing project config =========
These config files were loaded for project npg: [/Users/peter/projects/npg/npg_web/.ddev/config.yaml]
name: npg
type: php
docroot: htdocs
php_version: 8.1
webserver_type: apache-fpm
webimage: drud/ddev-webserver:v1.21.5
router_http_port: 80
router_https_port: 443
additional_hostnames: []
additional_fqdns: []
mariadb_version: 10.5
database: {mariadb 10.5}
mailhog_port: 8025
mailhog_https_port: 8026
phpmyadmin_port: 8036
phpmyadmin_https_port: 8037
project_tld: ddev.site
use_dns_when_possible: true
nodejs_version: 16
default_container_timeout: 120
======= Creating dummy project named  tryddevproject-9274 in ../tryddevproject-9274 =========
OS Information: Darwin MBP2021.local 22.5.0 Darwin Kernel Version 22.5.0: Thu Jun  8 22:22:20 PDT 2023; root:xnu-8796.121.3~7/RELEASE_ARM64_T6000 arm64
ProductName:		macOS
ProductVersion:		13.4.1
BuildVersion:		22F82
User information: uid=501(peter) gid=20(staff) groups=20(staff),12(everyone),61(localaccounts),79(_appserverusr),80(admin),81(_appserveradm),98(_lpadmin),701(com.apple.sharepoint.group.1),33(_appstore),100(_lpoperator),204(_developer),250(_analyticsusers),395(com.apple.access_ftp),398(com.apple.access_screensharing),399(com.apple.access_ssh),400(com.apple.access_remote_ae)
DDEV version:  ITEM             VALUE
 DDEV version     v1.21.6
 architecture     arm64
 db               drud/ddev-dbserver-mariadb-10.4:v1.21.5
 dba              phpmyadmin:5
 ddev-ssh-agent   drud/ddev-ssh-agent:v1.21.5
 docker           24.0.4
 docker-compose   v2.15.1
 docker-platform  docker
 mutagen          0.16.0
 os               darwin
 router           drud/ddev-router:v1.21.5
 web              drud/ddev-webserver:v1.21.5
PROXY settings: HTTP_PROXY='' HTTPS_PROXY='' http_proxy='' NO_PROXY=''
======= DDEV global info =========
Global configuration:
instrumentation-opt-in=true
omit-containers=[]
mutagen-enabled=false
nfs-mount-enabled=false
router-bind-all-interfaces=false
internet-detection-timeout-ms=3000
disable-http2=false
use-letsencrypt=false
letsencrypt-email=
table-style=default
simple-formatting=false
auto-restart-containers=false
use-hardened-images=false
fail-on-hook-fail=false
required-docker-compose-version=
use-docker-compose-from-path=false
project-tld=
xdebug-ide-location=
no-bind-mounts=false
use-traefik=false
wsl2-no-windows-hosts-mgt=false

======= DOCKER info =========
docker location: lrwxr-xr-x  1 root  wheel  53 24 Jul 15:42 /usr/local/bin/docker -> /Applications/OrbStack.app/Contents/MacOS/xbin/docker
Docker Desktop Version: Docker Desktop for Mac 4.21.1 build 114176
docker version:
Client:
 Version:           24.0.4
 API version:       1.43
 Go version:        go1.20.5
 Git commit:        3713ee1
 Built:             Fri Jul  7 14:47:27 2023
 OS/Arch:           darwin/arm64
 Context:           default

Server:
 Engine:
  Version:          24.0.4
  API version:      1.43 (minimum version 1.12)
  Go version:       go1.20.6
  Git commit:       4ffc61430bbe6d3d405bdf357b766bf303ff3cc5
  Built:            Fri Jul 14 13:18:38 2023
  OS/Arch:          linux/arm64
  Experimental:     false
 containerd:
  Version:          v1.7.2
  GitCommit:        0cae528dd6cb557f7201036e9f43420650207b58
 runc:
  Version:          1.1.8
  GitCommit:        82f18fe0e44a59034f3e1f45e475fa5636e539aa
 docker-init:
  Version:          0.19.0
  GitCommit:
DOCKER_DEFAULT_PLATFORM=notset
======= Mutagen Info =========
======= Docker Info =========
Docker platform: docker
Using docker context: default (unix:///Users/peter/.orbstack/run/docker.sock)
docker-compose: v2.15.1
Using DOCKER_HOST=unix:///Users/peter/.orbstack/run/docker.sock
Docker version: 24.0.4
Able to run simple container that mounts a volume.
Able to use internet inside container.
Docker disk space:
Filesystem                Size      Used Available Use% Mounted on
overlay                 264.2G      5.5G    258.8G   2% /

Container ddev-npg-elasticsearch  Removed
Container ddev-npg-db  Removed
Container ddev-npg-web  Removed
Container ddev-npg-dba  Removed
Network ddev-npg_default  Error
failed to remove network ddev-npg_default: Error response from daemon: error while removing network: network ddev-npg_default id 03c36ecc4635f7146f09cb9181b3c8db1f98b3c0583e1039aed6e3df3fdc9649 has active endpoints
Failed to docker-compose down: ComposeCmd failed to run 'COMPOSE_PROJECT_NAME=ddev-npg docker-compose -f /Users/peter/projects/npg/npg_web/.ddev/.ddev-docker-compose-full.yaml down', action='[down]', err='exit status 1', stdout='', stderr='Container ddev-npg-web  Stopping
Container ddev-npg-web  Stopping
Container ddev-npg-dba  Stopping
Container ddev-npg-dba  Stopping
Container ddev-npg-db  Stopping
Container ddev-npg-db  Stopping
Container ddev-npg-elasticsearch  Stopping
Container ddev-npg-elasticsearch  Stopping
Container ddev-npg-elasticsearch  Stopped
Container ddev-npg-elasticsearch  Removing
Container ddev-npg-elasticsearch  Removed
Container ddev-npg-db  Stopped
Container ddev-npg-db  Removing
Container ddev-npg-db  Removed
Container ddev-npg-web  Stopped
Container ddev-npg-web  Removing
Container ddev-npg-web  Removed
Container ddev-npg-dba  Stopped
Container ddev-npg-dba  Removing
Container ddev-npg-dba  Removed
Network ddev-npg_default  Removing
Network ddev-npg_default  Error
failed to remove network ddev-npg_default: Error response from daemon: error while removing network: network ddev-npg_default id 03c36ecc4635f7146f09cb9181b3c8db1f98b3c0583e1039aed6e3df3fdc9649 has active endpoints'
Removing container: ddev-npg-web-run-db17b45e5f8c
Removing container: ddev-npg-web-run-501f02f3f63d
Project npg has been stopped.
The ddev-ssh-agent container has been removed. When you start it again you will have to use 'ddev auth ssh' to provide key authentication again.
Existing docker containers:
CONTAINER ID   IMAGE     COMMAND   CREATED   STATUS    PORTS     NAMES
Creating a new ddev project config in the current directory (/Users/peter/projects/npg/tryddevproject-9274)
Once completed, your configuration will be written to /Users/peter/projects/npg/tryddevproject-9274/.ddev/config.yaml

Configuring unrecognized codebase as project type 'php' at /Users/peter/projects/npg/tryddevproject-9274/web
Configuration complete. You may now run 'ddev start'.
Network ddev_default created
Starting tryddevproject-9274...
Container ddev-ssh-agent  Started
ssh-agent container is running: If you want to add authentication to the ssh-agent container, run 'ddev auth ssh' to enable your keys.
v1.21.5: Pulling from drud/ddev-dbserver-mariadb-10.4
970e18d4d6e7: Already exists
8e1696491692: Already exists
fdaddccffd64: Already exists
3916deba3048: Already exists
1cd2db5c00a0: Pull complete
763136347ea3: Pull complete
9fbbbbe6aadb: Pull complete
3d5e4be2696f: Pull complete
e4554e9c224b: Pull complete
4f4fb700ef54: Pull complete
1dc40240383f: Pull complete
e874df046cc2: Pull complete
86140e227aaa: Pull complete
22ff3eb0b980: Pull complete
9e61d5ae7fe0: Pull complete
a3c19fbcb613: Pull complete
3c5741040871: Pull complete
1ffc539f9ccb: Pull complete
ca0cb63dbcb0: Pull complete
eada3ebe2860: Pull complete
149b49488bc6: Pull complete
8d2045d8a17d: Pull complete
c891587387a1: Pull complete
0be54c4d4ee7: Pull complete
Digest: sha256:5c09a3302f5d77780e7cf2987762aefe2c0e0bcb603cb9624d1cc8624a9c6f30
Status: Downloaded newer image for drud/ddev-dbserver-mariadb-10.4:v1.21.5
docker.io/drud/ddev-dbserver-mariadb-10.4:v1.21.5
Network ddev-tryddevproject-9274_default  Created
Container ddev-tryddevproject-9274-web  Started
Container ddev-tryddevproject-9274-db  Started
Container ddev-tryddevproject-9274-dba  Started
Container ddev-router  Started
Successfully started tryddevproject-9274
Project can be reached at https://tryddevproject-9274.ddev.site https://127.0.0.1:32783
======== Curl of site from inside container:
HTTP/1.1 200 OK
Server: nginx
Date: Tue, 25 Jul 2023 08:33:01 GMT
Content-Type: text/html; charset=UTF-8
Connection: keep-alive
Vary: Accept-Encoding

======== curl -I of http://tryddevproject-9274.ddev.site from outside:
HTTP/1.1 200 OK
Server: nginx/1.20.1
Date: Tue, 25 Jul 2023 08:33:01 GMT
Content-Type: text/html; charset=UTF-8
Connection: keep-alive
Vary: Accept-Encoding

======== full curl of http://tryddevproject-9274.ddev.site from outside:
Success accessing database... db via TCP/IP
ddev is working. You will want to delete this project with 'ddev delete -Oy tryddevproject-9274'
======== Project ownership on host:
drwxr-xr-x  4 peter  staff  128 25 Jul 09:32 ../tryddevproject-9274
======== Project ownership in container:
drwxr-xr-x 4 peter dialout 128 Jul 25 08:32 /var/www/html
======== In-container filesystem:
Filesystem     Type     1K-blocks      Used Available Use% Mounted on
mac            virtiofs 971350180 688718612 282631568  71% /var/www/html
======== curl again of tryddevproject-9274 from host:
Success accessing database... db via TCP/IP
ddev is working. You will want to delete this project with 'ddev delete -Oy tryddevproject-9274'
Thanks for running the diagnostic. It was successful.
Please provide the output of this script in a new gist at gist.github.com
Running ddev launch in 5 seconds
If you're brave and you have jq you can delete all tryddevproject instances with this one-liner:
    ddev delete -Oy $(ddev list -j |jq -r .raw[].name | grep tryddevproject)
In the future ddev debug test will also provide this option.

Please delete this project after debugging with 'ddev delete -Oy tryddevproject-9274'

Expected Behavior

I have a PHP site running within ddev, and on my host machine I run vite with a default configuration (so bound to localhost:5173).

I'd expect them to run alongside each other, but running Vite's dev server with HMR seems to kill DDEV.

Actual Behavior

502: Unresponsive/broken ddev back-end site.
This is the ddev-router container: The back-end webserver at the URL you specified is not responding. You may want to use "ddev restart" to restart the site.

The network hangs around and if I do a ddev stop

Steps To Reproduce

So, this doesn't reproduce 100% of the time but over the last couple of days this is the closest I can get to a reproducer.

When the HTTP 502 happens I try the following:

> ddev stop
Container ddev-npg-db  Removed
Container ddev-npg-elasticsearch  Removed
Container ddev-npg-web  Removed
Container ddev-npg-dba  Removed
Network ddev-npg_default  Error
failed to remove network ddev-npg_default: Error response from daemon: error while removing network: network ddev-npg_default id 03c36ecc4635f7146f09cb9181b3c8db1f98b3c0583e1039aed6e3df3fdc9649 has active endpoints
Failed to docker-compose down: ComposeCmd failed to run 'COMPOSE_PROJECT_NAME=ddev-npg docker-compose -f /Users/peter/projects/npg/npg_web/.ddev/.ddev-docker-compose-full.yaml down', action='[down]', err='exit status 1', stdout='', stderr='Container ddev-npg-web  Stopping
Container ddev-npg-web  Stopping
Container ddev-npg-db  Stopping
Container ddev-npg-db  Stopping
Container ddev-npg-elasticsearch  Stopping
Container ddev-npg-elasticsearch  Stopping
Container ddev-npg-dba  Stopping
Container ddev-npg-dba  Stopping
Container ddev-npg-db  Stopped
Container ddev-npg-db  Removing
Container ddev-npg-db  Removed
Container ddev-npg-elasticsearch  Stopped
Container ddev-npg-elasticsearch  Removing
Container ddev-npg-elasticsearch  Removed
Container ddev-npg-web  Stopped
Container ddev-npg-web  Removing
Container ddev-npg-web  Removed
Container ddev-npg-dba  Stopped
Container ddev-npg-dba  Removing
Container ddev-npg-dba  Removed
Network ddev-npg_default  Removing
Network ddev-npg_default  Error
failed to remove network ddev-npg_default: Error response from daemon: error while removing network: network ddev-npg_default id 03c36ecc4635f7146f09cb9181b3c8db1f98b3c0583e1039aed6e3df3fdc9649 has active endpoints'
Removing container: ddev-npg-web-run-cead698ab009
Project npg has been stopped.

Trying to restart leads to:

> ddev start
Starting npg...
Using custom mysql configuration: [/Users/peter/projects/npg/npg_web/.ddev/mysql/my-npg.cnf]
Custom configuration is updated on restart.
If you don't see your custom configuration taking effect, run 'ddev restart'.
Container ddev-npg-dba  Started
Container ddev-npg-web  Started
Container ddev-npg-db  Started
Container ddev-npg-elasticsearch  Started
Container ddev-router  Started
Failed to start npg: container(s) failed to become healthy before their configured timeout or in 120 seconds. This may be just a problem with the healthcheck and not a functional problem. (health check timed out: labels map[com.ddev.site-name:npg] timed out without becoming healthy, status=, detail= ddev-npg-web-run-bd3dd0de6a9a:starting - more info with `docker inspect --format "{{json .State.Health }}" ddev-npg-web-run-bd3dd0de6a9a` )
> docker network ls
NETWORK ID     NAME               DRIVER    SCOPE
de785f219008   bridge             bridge    local
03c36ecc4635   ddev-npg_default   bridge    local
0c8e9b9f2705   ddev_default       bridge    local
d97be534fb66   host               host      local
b159031a67f9   none               null      local

> docker network rm ddev-npg_default
Error response from daemon: error while removing network: network ddev-npg_default id 03c36ecc4635f7146f09cb9181b3c8db1f98b3c0583e1039aed6e3df3fdc9649 has active endpoints

> ddev poweroff
Container ddev-npg-dba  Removed
Container ddev-npg-db  Removed
Container ddev-npg-elasticsearch  Removed
Container ddev-npg-web  Removed
Network ddev-npg_default  Error
failed to remove network ddev-npg_default: Error response from daemon: error while removing network: network ddev-npg_default id 03c36ecc4635f7146f09cb9181b3c8db1f98b3c0583e1039aed6e3df3fdc9649 has active endpoints
Failed to docker-compose down: ComposeCmd failed to run 'COMPOSE_PROJECT_NAME=ddev-npg docker-compose -f /Users/peter/projects/npg/npg_web/.ddev/.ddev-docker-compose-full.yaml down', action='[down]', err='exit status 1', stdout='', stderr='Container ddev-npg-web  Stopping
Container ddev-npg-elasticsearch  Stopping
Container ddev-npg-web  Stopping
Container ddev-npg-elasticsearch  Stopping
Container ddev-npg-db  Stopping
Container ddev-npg-db  Stopping
Container ddev-npg-dba  Stopping
Container ddev-npg-dba  Stopping
Container ddev-npg-web  Stopped
Container ddev-npg-web  Removing
Container ddev-npg-dba  Stopped
Container ddev-npg-dba  Removing
Container ddev-npg-elasticsearch  Stopped
Container ddev-npg-elasticsearch  Removing
Container ddev-npg-db  Stopped
Container ddev-npg-db  Removing
Container ddev-npg-dba  Removed
Container ddev-npg-db  Removed
Container ddev-npg-elasticsearch  Removed
Container ddev-npg-web  Removed
Network ddev-npg_default  Removing
Network ddev-npg_default  Error
failed to remove network ddev-npg_default: Error response from daemon: error while removing network: network ddev-npg_default id 03c36ecc4635f7146f09cb9181b3c8db1f98b3c0583e1039aed6e3df3fdc9649 has active endpoints'
Removing container: ddev-npg-web-run-bd3dd0de6a9a
Project npg has been stopped.
The ddev-ssh-agent container has been removed. When you start it again you will have to use 'ddev auth ssh' to provide key authentication again.

> docker network ls
NETWORK ID     NAME               DRIVER    SCOPE
de785f219008   bridge             bridge    local
03c36ecc4635   ddev-npg_default   bridge    local
d97be534fb66   host               host      local
b159031a67f9   none               null      local

> docker network rm ddev-npg_default
ddev-npg_default

Once I run that I can now run ddev start and it works.

Now I run npm run dev again in my subfolder:

  VITE v4.4.7  ready in 149 ms

  ➜  Local:   https://localhost:5173/
  ➜  Network: use --host to expose
  ➜  press h to show help

Reload my PHP page a couple of times, and ddev goes back to returning the HTTP 502.

Anything else?

I thought it might be a bug in Docker, so I installed OrbStack with this DDEV setup the only set of containers/networks in it. The problem happens just the same, which is why I'm posting here as it could be to do with DDEV instead.

vite.config.ts:

import { defineConfig } from 'vite'
// @ts-ignore
import fs from 'fs'
// @ts-ignore
import path from 'path'

export default defineConfig({
    server: {
        https: {
            key: fs.readFileSync(path.resolve(__dirname, 'localhost-key.pem')),
            cert: fs.readFileSync(path.resolve(__dirname, 'localhost.pem'))
        }
    },
    plugins: [
    ],
    css: {
        devSourcemap: true
    },
    build: {
        manifest: true,
        rollupOptions: {
            input: {
                main: './main.js',
            }
        },
        outDir: '../htdocs/assets/dist'
    }
})

And the minimal parts of my package.json:

{
  "dependencies": {
  },
  "scripts": {
    "dev": "rm -rf dist/* && vite",
    "build": "vite build",
    "preview": "vite preview"
  },
  "devDependencies": {
    "vite": "^4.4.7"
  }
}
@pbowyer
Copy link
Author

pbowyer commented Jul 25, 2023

I've just seen that DDEV v1.22 has been released since I started writing this ticket. I've upgraded and will report if it still happens.

@rfay
Copy link
Member

rfay commented Jul 25, 2023

DDEV v1.22.0 uses the Traefik router by default, whereas previous versions used the nginx-proxy router by default (but had Traefik as an option).

Looking forward to your results. Are you using https://github.com/torenware/ddev-viteserve ?

@rfay
Copy link
Member

rfay commented Jul 25, 2023

I see

failed to remove network ddev-npg_default: Error response from daemon: error while removing network: network ddev-npg_default id 03c36ecc4635f7146f09cb9181b3c8db1f98b3c0583e1039aed6e3df3fdc9649 has active endpoints'

It looks like you have a docker problem. And I see you're using Orbstack. I've spent a bit of time with Orbstack, but we haven't run a complete set of tests for it, and it doesn't have automated tests. So I would suspect Orbstack.

Also, do try DDEV v1.22.0 and the Traefik router, but it sure looks like you have docker trouble.

And please do see if you can recreate on Colima or Docker Desktop.

@rfay rfay changed the title Vite on host breaks ddev-router Vite on host breaks ddev-router (Orbstack Docker Network Trouble) Jul 25, 2023
@pbowyer
Copy link
Author

pbowyer commented Jul 25, 2023

Hi @rfay until 36 hours ago I was using Docker Desktop and getting an identical problem, with the spec:

ProductName:		macOS
ProductVersion:		13.4.1
BuildVersion:		22F82
---
Docker Desktop 4.21.1 (114176)
Docker version 24.0.2, build cb74dfc
ddev version v1.21.6

I thought I might have a Docker problem so I installed OrbStack with this DDEV project the only set of containers/networks in it. The problem happened just the same, despite Orbstack having its own network stack implementation.

Since I updated to ddev version 1.220.0 10 hours ago it hasn't happened, so fingers crossed that traefik has sorted it. I'll be back on this project next week so will wait and see if it remains sorted!

@rfay
Copy link
Member

rfay commented Jul 25, 2023

You were getting the identical problem with failing to remove the docker network?

failed to remove network ddev-npg_default: Error response from daemon: error while removing network: network ddev-npg_default id 03c36ecc4635f7146f09cb9181b3c8db1f98b3c0583e1039aed6e3df3fdc9649 has active endpoints'

I sure wouldn't expect to see that the same way on two different docker providers. I wonder if you're running a separate container using that network that is not managed by DDEV so DDEV doesn't stop the container?

I too hope you don't have the problem any more but you may have to develop a full reproduction case that shows what happens here, because this sounds really unusual. One thing to do is to study docker ps -a when you see this problem. What container is still there and still causing trouble?

@pbowyer
Copy link
Author

pbowyer commented Jul 26, 2023

Okay so... I've been working on another project that uses ddev all day. It's been running fine.

I go to start the npg project this evening to do a bit of development and...

> ddev start
Starting npg...
Using custom mysql configuration: [/Users/peter/projects/npg/npg_web/.ddev/mysql/my-npg.cnf]
Custom configuration is updated on restart.
If you don't see your custom configuration taking effect, run 'ddev restart'.
 Container ddev-npg-web  Recreate
 Container ddev-npg-elasticsearch  Created
 Container ddev-npg-web  Recreated
 Container ddev-npg-db  Created
Error response from daemon: network ddev-npg_default is ambiguous (16 matches found on name)
Failed to start npg: ComposeCmd failed to run 'COMPOSE_PROJECT_NAME=ddev-npg docker-compose -f /Users/peter/projects/npg/npg_web/.ddev/.ddev-docker-compose-full.yaml up -d', action='[up -d]', err='exit status 1', stdout='', stderr=' Container ddev-npg-elasticsearch  Creating
 Container ddev-npg-db  Creating
 Container ddev-npg-web  Recreate
 Container ddev-npg-elasticsearch  Created
 Container ddev-npg-web  Recreated
 Container ddev-npg-db  Created
 Container ddev-npg-elasticsearch  Starting
 Container ddev-npg-db  Starting
 Container ddev-npg-web  Starting
Error response from daemon: network ddev-npg_default is ambiguous (16 matches found on name)'

I mean how??? How are so many network providers proliferating?

docker ps -a gives

> docker ps -a                                                                                                                       (base)
CONTAINER ID   IMAGE                                                  COMMAND                  CREATED         STATUS                  PORTS                                                                                                        NAMES
13780feedf2f   ddev/ddev-dbserver-mariadb-10.5:v1.22.0-npg-built      "/docker-entrypoint.…"   2 minutes ago   Created                                                                                                                              ddev-npg-db
bd09c50672f9   ddev/ddev-webserver:v1.22.0-npg-built                  "/pre-start.sh"          2 minutes ago   Created                                                                                                                              ddev-npg-web
739edf0e4ce7   elasticsearch:7.17.1                                   "/bin/tini -- /usr/l…"   2 minutes ago   Created                                                                                                                              ddev-npg-elasticsearch
24ebd97087ed   traefik:v2.10-built                                    "/entrypoint.sh --co…"   10 hours ago    Up 10 hours (healthy)   127.0.0.1:80->80/tcp, 127.0.0.1:443->443/tcp, 127.0.0.1:8025-8026->8025-8026/tcp, 127.0.0.1:9999->9999/tcp   ddev-router
a4b7266ba25e   ddev/ddev-webserver:v1.22.0-donations-built            "/pre-start.sh"          10 hours ago    Up 10 hours (healthy)   8025/tcp, 127.0.0.1:32854->80/tcp, 127.0.0.1:32853->443/tcp                                                  ddev-donations-web
b5d5debad450   ddev/ddev-dbserver-mysql-5.7:v1.22.0-donations-built   "/docker-entrypoint.…"   10 hours ago    Up 10 hours (healthy)   127.0.0.1:32855->3306/tcp                                                                                    ddev-donations-db
f3fde3ba6d5f   422dec05bb87                                           "/bin/sh"                12 hours ago    Created                                                                                                                              phpstorm_helpers_PS-231.9225.18
12c14a348ce6   ddev/ddev-ssh-agent:v1.22.0-built                      "/entry.sh ssh-agent"    13 hours ago    Up 13 hours (healthy)                                                                                                                ddev-ssh-agent

And yes there really are all those bridged networks available.

 > docker network ls
NETWORK ID     NAME                     DRIVER    SCOPE
de785f219008   bridge                   bridge    local
b8b5b1cbfa5b   ddev-api_default     bridge    local
1551fbbadb17   ddev-donations_default   bridge    local
11bf201606a1   ddev-npg_default         bridge    local
e15e08c02420   ddev-npg_default         bridge    local
097c64c3b451   ddev-npg_default         bridge    local
a2d3d525602e   ddev-npg_default         bridge    local
c98e5d962bf0   ddev-npg_default         bridge    local
37cdbdac5c7c   ddev-npg_default         bridge    local
24b2dc829019   ddev-npg_default         bridge    local
6e67154e671d   ddev-npg_default         bridge    local
b7ac255a1637   ddev-npg_default         bridge    local
6e0f4984161e   ddev-npg_default         bridge    local
383eaddbf116   ddev-npg_default         bridge    local
e752d1c4a07e   ddev-npg_default         bridge    local
b3c1a8402ec6   ddev-npg_default         bridge    local
b7666248b41c   ddev-npg_default         bridge    local
875b6ad42287   ddev-npg_default         bridge    local
5524351b74c9   ddev-npg_default         bridge    local
4da194a5386a   ddev_default             bridge    local
d97be534fb66   host                     host      local
b159031a67f9   none                     null      local

Aside: ddev-api has not been run for weeks and is dangling.

Let's inspect them:

> docker network ls | awk '{ print $1; }' | xargs docker network inspect 
[
    {
        "Name": "bridge",
        "Id": "de785f219008b1e00cceb19f006bd547f3184802682fecced51a1edec00e9364",
        "Created": "2023-07-24T14:42:29.931590666Z",
        "Scope": "local",
        "Driver": "bridge",
        "EnableIPv6": false,
        "IPAM": {
            "Driver": "default",
            "Options": null,
            "Config": [
                {
                    "Subnet": "192.168.215.0/24",
                    "Gateway": "192.168.215.1"
                }
            ]
        },
        "Internal": false,
        "Attachable": false,
        "Ingress": false,
        "ConfigFrom": {
            "Network": ""
        },
        "ConfigOnly": false,
        "Containers": {},
        "Options": {
            "com.docker.network.bridge.default_bridge": "true",
            "com.docker.network.bridge.enable_icc": "true",
            "com.docker.network.bridge.enable_ip_masquerade": "true",
            "com.docker.network.bridge.host_binding_ipv4": "0.0.0.0",
            "com.docker.network.bridge.name": "docker0",
            "com.docker.network.driver.mtu": "1500"
        },
        "Labels": {}
    },
    {
        "Name": "ddev-api_default",
        "Id": "b8b5b1cbfa5b49b1d6f9f5896345c36ae11b8e359b1e813d83e7caa4b9431d6b",
        "Created": "2023-07-26T10:33:08.659300359Z",
        "Scope": "local",
        "Driver": "bridge",
        "EnableIPv6": false,
        "IPAM": {
            "Driver": "default",
            "Options": null,
            "Config": [
                {
                    "Subnet": "192.168.229.0/24",
                    "Gateway": "192.168.229.1"
                }
            ]
        },
        "Internal": false,
        "Attachable": false,
        "Ingress": false,
        "ConfigFrom": {
            "Network": ""
        },
        "ConfigOnly": false,
        "Containers": {},
        "Options": {},
        "Labels": {
            "com.docker.compose.network": "default",
            "com.docker.compose.project": "ddev-digiapi",
            "com.docker.compose.version": "2.19.1"
        }
    },
    {
        "Name": "ddev-donations_default",
        "Id": "1551fbbadb174667ac9ec39168d6745230f96c946400877c1448d56ea37b14b7",
        "Created": "2023-07-26T09:48:06.198882867Z",
        "Scope": "local",
        "Driver": "bridge",
        "EnableIPv6": false,
        "IPAM": {
            "Driver": "default",
            "Options": null,
            "Config": [
                {
                    "Subnet": "192.168.147.0/24",
                    "Gateway": "192.168.147.1"
                }
            ]
        },
        "Internal": false,
        "Attachable": false,
        "Ingress": false,
        "ConfigFrom": {
            "Network": ""
        },
        "ConfigOnly": false,
        "Containers": {
            "a4b7266ba25e2f0eeaaa93eea2182dcc64caa84ff0114e78f51cf4461a389525": {
                "Name": "ddev-donations-web",
                "EndpointID": "bfac794f97585e0bddcae440be2be7d584429b5a32eb14a9a702d25d15cc0b0a",
                "MacAddress": "02:42:c0:a8:93:02",
                "IPv4Address": "192.168.147.2/24",
                "IPv6Address": ""
            },
            "b5d5debad4506e508ee4558a300610f591d28639d7e24683ea9a52ca3a14ed6f": {
                "Name": "ddev-donations-db",
                "EndpointID": "a9b6d65c06404f009817c86614086afc9ce672e5e0530069605ddb23139be9bf",
                "MacAddress": "02:42:c0:a8:93:03",
                "IPv4Address": "192.168.147.3/24",
                "IPv6Address": ""
            }
        },
        "Options": {},
        "Labels": {
            "com.docker.compose.network": "default",
            "com.docker.compose.project": "ddev-donations",
            "com.docker.compose.version": "2.20.0"
        }
    },
    {
        "Name": "ddev-npg_default",
        "Id": "11bf201606a1ca3032136b39929f7af8a2271a618eac80419808b21676ca52a7",
        "Created": "2023-07-26T19:37:58.761085106Z",
        "Scope": "local",
        "Driver": "bridge",
        "EnableIPv6": false,
        "IPAM": {
            "Driver": "default",
            "Options": null,
            "Config": [
                {
                    "Subnet": "192.168.166.0/24",
                    "Gateway": "192.168.166.1"
                }
            ]
        },
        "Internal": false,
        "Attachable": false,
        "Ingress": false,
        "ConfigFrom": {
            "Network": ""
        },
        "ConfigOnly": false,
        "Containers": {},
        "Options": {},
        "Labels": {
            "com.docker.compose.network": "default",
            "com.docker.compose.project": "ddev-npg",
            "com.docker.compose.version": "2.19.1"
        }
    },
    {
        "Name": "ddev-npg_default",
        "Id": "b7666248b41c16f1d2c4896d43367108e8edb28f92d139009541f7fa62542949",
        "Created": "2023-07-26T19:37:58.771893903Z",
        "Scope": "local",
        "Driver": "bridge",
        "EnableIPv6": false,
        "IPAM": {
            "Driver": "default",
            "Options": null,
            "Config": [
                {
                    "Subnet": "172.17.0.0/16",
                    "Gateway": "172.17.0.1"
                }
            ]
        },
        "Internal": false,
        "Attachable": false,
        "Ingress": false,
        "ConfigFrom": {
            "Network": ""
        },
        "ConfigOnly": false,
        "Containers": {},
        "Options": {},
        "Labels": {
            "com.docker.compose.network": "default",
            "com.docker.compose.project": "ddev-npg",
            "com.docker.compose.version": "2.19.1"
        }
    },
    {
        "Name": "ddev-npg_default",
        "Id": "383eaddbf1161ad32ffd7c60656f7112a0294eead70c59cb09d30a3a8fbe557a",
        "Created": "2023-07-26T19:37:58.760054816Z",
        "Scope": "local",
        "Driver": "bridge",
        "EnableIPv6": false,
        "IPAM": {
            "Driver": "default",
            "Options": null,
            "Config": [
                {
                    "Subnet": "192.168.242.0/24",
                    "Gateway": "192.168.242.1"
                }
            ]
        },
        "Internal": false,
        "Attachable": false,
        "Ingress": false,
        "ConfigFrom": {
            "Network": ""
        },
        "ConfigOnly": false,
        "Containers": {},
        "Options": {},
        "Labels": {
            "com.docker.compose.network": "default",
            "com.docker.compose.project": "ddev-npg",
            "com.docker.compose.version": "2.19.1"
        }
    },
    {
        "Name": "ddev-npg_default",
        "Id": "a2d3d525602e04c40fd88084eae7fdc8bf884b43ccd9e81de665b80e6aded498",
        "Created": "2023-07-26T19:37:58.759321264Z",
        "Scope": "local",
        "Driver": "bridge",
        "EnableIPv6": false,
        "IPAM": {
            "Driver": "default",
            "Options": null,
            "Config": [
                {
                    "Subnet": "192.168.97.0/24",
                    "Gateway": "192.168.97.1"
                }
            ]
        },
        "Internal": false,
        "Attachable": false,
        "Ingress": false,
        "ConfigFrom": {
            "Network": ""
        },
        "ConfigOnly": false,
        "Containers": {},
        "Options": {},
        "Labels": {
            "com.docker.compose.network": "default",
            "com.docker.compose.project": "ddev-npg",
            "com.docker.compose.version": "2.19.1"
        }
    },
    {
        "Name": "ddev-npg_default",
        "Id": "c98e5d962bf03314d49a92f454f476b397c3311a595e08b1bacd63df4943ed8a",
        "Created": "2023-07-26T19:37:58.761876865Z",
        "Scope": "local",
        "Driver": "bridge",
        "EnableIPv6": false,
        "IPAM": {
            "Driver": "default",
            "Options": null,
            "Config": [
                {
                    "Subnet": "192.168.223.0/24",
                    "Gateway": "192.168.223.1"
                }
            ]
        },
        "Internal": false,
        "Attachable": false,
        "Ingress": false,
        "ConfigFrom": {
            "Network": ""
        },
        "ConfigOnly": false,
        "Containers": {},
        "Options": {},
        "Labels": {
            "com.docker.compose.network": "default",
            "com.docker.compose.project": "ddev-npg",
            "com.docker.compose.version": "2.19.1"
        }
    },
    {
        "Name": "ddev-npg_default",
        "Id": "37cdbdac5c7c8f3c5b9d3aa3764f8028a115f29a9014342688cb21f17a6eff9e",
        "Created": "2023-07-26T19:37:58.762113063Z",
        "Scope": "local",
        "Driver": "bridge",
        "EnableIPv6": false,
        "IPAM": {
            "Driver": "default",
            "Options": null,
            "Config": [
                {
                    "Subnet": "192.168.163.0/24",
                    "Gateway": "192.168.163.1"
                }
            ]
        },
        "Internal": false,
        "Attachable": false,
        "Ingress": false,
        "ConfigFrom": {
            "Network": ""
        },
        "ConfigOnly": false,
        "Containers": {},
        "Options": {},
        "Labels": {
            "com.docker.compose.network": "default",
            "com.docker.compose.project": "ddev-npg",
            "com.docker.compose.version": "2.19.1"
        }
    },
    {
        "Name": "ddev-npg_default",
        "Id": "24b2dc82901983e3c079107aaddfab832cdd0c224349111f5e79190ac155e0ab",
        "Created": "2023-07-26T19:37:58.768689371Z",
        "Scope": "local",
        "Driver": "bridge",
        "EnableIPv6": false,
        "IPAM": {
            "Driver": "default",
            "Options": null,
            "Config": [
                {
                    "Subnet": "192.168.138.0/24",
                    "Gateway": "192.168.138.1"
                }
            ]
        },
        "Internal": false,
        "Attachable": false,
        "Ingress": false,
        "ConfigFrom": {
            "Network": ""
        },
        "ConfigOnly": false,
        "Containers": {},
        "Options": {},
        "Labels": {
            "com.docker.compose.network": "default",
            "com.docker.compose.project": "ddev-npg",
            "com.docker.compose.version": "2.19.1"
        }
    },
    {
        "Name": "ddev-npg_default",
        "Id": "5524351b74c94e7f31a2911a68f0535e2aba9819e5f72ba635158cb63d7419ec",
        "Created": "2023-07-26T19:37:58.762447133Z",
        "Scope": "local",
        "Driver": "bridge",
        "EnableIPv6": false,
        "IPAM": {
            "Driver": "default",
            "Options": null,
            "Config": [
                {
                    "Subnet": "192.168.172.0/24",
                    "Gateway": "192.168.172.1"
                }
            ]
        },
        "Internal": false,
        "Attachable": false,
        "Ingress": false,
        "ConfigFrom": {
            "Network": ""
        },
        "ConfigOnly": false,
        "Containers": {},
        "Options": {},
        "Labels": {
            "com.docker.compose.network": "default",
            "com.docker.compose.project": "ddev-npg",
            "com.docker.compose.version": "2.19.1"
        }
    },
    {
        "Name": "ddev-npg_default",
        "Id": "b7ac255a16370b1134bc18f27388f2e95bd977a1d7f1abb648ff09518ab0df5c",
        "Created": "2023-07-26T19:37:58.758226434Z",
        "Scope": "local",
        "Driver": "bridge",
        "EnableIPv6": false,
        "IPAM": {
            "Driver": "default",
            "Options": null,
            "Config": [
                {
                    "Subnet": "192.168.183.0/24",
                    "Gateway": "192.168.183.1"
                }
            ]
        },
        "Internal": false,
        "Attachable": false,
        "Ingress": false,
        "ConfigFrom": {
            "Network": ""
        },
        "ConfigOnly": false,
        "Containers": {},
        "Options": {},
        "Labels": {
            "com.docker.compose.network": "default",
            "com.docker.compose.project": "ddev-npg",
            "com.docker.compose.version": "2.19.1"
        }
    },
    {
        "Name": "ddev-npg_default",
        "Id": "b3c1a8402ec6bc503982ac57e5af4b76b4d0f79badca5c390e7a91f356bd83c2",
        "Created": "2023-07-26T19:37:58.761975736Z",
        "Scope": "local",
        "Driver": "bridge",
        "EnableIPv6": false,
        "IPAM": {
            "Driver": "default",
            "Options": null,
            "Config": [
                {
                    "Subnet": "192.168.164.0/24",
                    "Gateway": "192.168.164.1"
                }
            ]
        },
        "Internal": false,
        "Attachable": false,
        "Ingress": false,
        "ConfigFrom": {
            "Network": ""
        },
        "ConfigOnly": false,
        "Containers": {},
        "Options": {},
        "Labels": {
            "com.docker.compose.network": "default",
            "com.docker.compose.project": "ddev-npg",
            "com.docker.compose.version": "2.19.1"
        }
    },
    {
        "Name": "ddev-npg_default",
        "Id": "097c64c3b451275467cb38a108475cb96b9720a1e428b3efeb1c81fa4bdb3b7d",
        "Created": "2023-07-26T19:37:58.761703497Z",
        "Scope": "local",
        "Driver": "bridge",
        "EnableIPv6": false,
        "IPAM": {
            "Driver": "default",
            "Options": null,
            "Config": [
                {
                    "Subnet": "192.168.239.0/24",
                    "Gateway": "192.168.239.1"
                }
            ]
        },
        "Internal": false,
        "Attachable": false,
        "Ingress": false,
        "ConfigFrom": {
            "Network": ""
        },
        "ConfigOnly": false,
        "Containers": {},
        "Options": {},
        "Labels": {
            "com.docker.compose.network": "default",
            "com.docker.compose.project": "ddev-npg",
            "com.docker.compose.version": "2.19.1"
        }
    },
    {
        "Name": "ddev-npg_default",
        "Id": "e752d1c4a07eafff4f18bb5bbea4508d3da995095bfec42050ac7bacf385e91e",
        "Created": "2023-07-26T19:37:58.759271974Z",
        "Scope": "local",
        "Driver": "bridge",
        "EnableIPv6": false,
        "IPAM": {
            "Driver": "default",
            "Options": null,
            "Config": [
                {
                    "Subnet": "192.168.156.0/24",
                    "Gateway": "192.168.156.1"
                }
            ]
        },
        "Internal": false,
        "Attachable": false,
        "Ingress": false,
        "ConfigFrom": {
            "Network": ""
        },
        "ConfigOnly": false,
        "Containers": {},
        "Options": {},
        "Labels": {
            "com.docker.compose.network": "default",
            "com.docker.compose.project": "ddev-npg",
            "com.docker.compose.version": "2.19.1"
        }
    },
    {
        "Name": "ddev-npg_default",
        "Id": "6e0f4984161e6082cc204649f39a13589c0238e4f0507d7559c7326c0a90febd",
        "Created": "2023-07-26T19:37:58.759860366Z",
        "Scope": "local",
        "Driver": "bridge",
        "EnableIPv6": false,
        "IPAM": {
            "Driver": "default",
            "Options": null,
            "Config": [
                {
                    "Subnet": "192.168.216.0/24",
                    "Gateway": "192.168.216.1"
                }
            ]
        },
        "Internal": false,
        "Attachable": false,
        "Ingress": false,
        "ConfigFrom": {
            "Network": ""
        },
        "ConfigOnly": false,
        "Containers": {},
        "Options": {},
        "Labels": {
            "com.docker.compose.network": "default",
            "com.docker.compose.project": "ddev-npg",
            "com.docker.compose.version": "2.19.1"
        }
    },
    {
        "Name": "ddev-npg_default",
        "Id": "e15e08c0242033d7e80d591a3c27483c048d3684b75720e7b7bfd6b9fd9470ad",
        "Created": "2023-07-26T19:37:58.759730246Z",
        "Scope": "local",
        "Driver": "bridge",
        "EnableIPv6": false,
        "IPAM": {
            "Driver": "default",
            "Options": null,
            "Config": [
                {
                    "Subnet": "192.168.186.0/24",
                    "Gateway": "192.168.186.1"
                }
            ]
        },
        "Internal": false,
        "Attachable": false,
        "Ingress": false,
        "ConfigFrom": {
            "Network": ""
        },
        "ConfigOnly": false,
        "Containers": {},
        "Options": {},
        "Labels": {
            "com.docker.compose.network": "default",
            "com.docker.compose.project": "ddev-npg",
            "com.docker.compose.version": "2.19.1"
        }
    },
    {
        "Name": "ddev-npg_default",
        "Id": "875b6ad4228792633bb93d4e24bf21e87221960beef758189ac885bcf97af5c7",
        "Created": "2023-07-26T19:37:58.77415635Z",
        "Scope": "local",
        "Driver": "bridge",
        "EnableIPv6": false,
        "IPAM": {
            "Driver": "default",
            "Options": null,
            "Config": [
                {
                    "Subnet": "172.18.0.0/16",
                    "Gateway": "172.18.0.1"
                }
            ]
        },
        "Internal": false,
        "Attachable": false,
        "Ingress": false,
        "ConfigFrom": {
            "Network": ""
        },
        "ConfigOnly": false,
        "Containers": {},
        "Options": {},
        "Labels": {
            "com.docker.compose.network": "default",
            "com.docker.compose.project": "ddev-npg",
            "com.docker.compose.version": "2.19.1"
        }
    },
    {
        "Name": "ddev-npg_default",
        "Id": "6e67154e671d54bc4055c37315223e1dd3ef557bcc18cd164f888d2aedae8817",
        "Created": "2023-07-26T19:37:58.759433676Z",
        "Scope": "local",
        "Driver": "bridge",
        "EnableIPv6": false,
        "IPAM": {
            "Driver": "default",
            "Options": null,
            "Config": [
                {
                    "Subnet": "192.168.171.0/24",
                    "Gateway": "192.168.171.1"
                }
            ]
        },
        "Internal": false,
        "Attachable": false,
        "Ingress": false,
        "ConfigFrom": {
            "Network": ""
        },
        "ConfigOnly": false,
        "Containers": {},
        "Options": {},
        "Labels": {
            "com.docker.compose.network": "default",
            "com.docker.compose.project": "ddev-npg",
            "com.docker.compose.version": "2.19.1"
        }
    },
    {
        "Name": "ddev_default",
        "Id": "4da194a5386a4466347a852ee9ac79b037f5d94035a3917bc69648ba3fadea85",
        "Created": "2023-07-26T06:35:16.376553556Z",
        "Scope": "local",
        "Driver": "bridge",
        "EnableIPv6": false,
        "IPAM": {
            "Driver": "default",
            "Options": null,
            "Config": [
                {
                    "Subnet": "192.168.227.0/24",
                    "Gateway": "192.168.227.1"
                }
            ]
        },
        "Internal": false,
        "Attachable": false,
        "Ingress": false,
        "ConfigFrom": {
            "Network": ""
        },
        "ConfigOnly": false,
        "Containers": {
            "12c14a348ce6b7ffefd7ad5c4c25e4ccc3a306adc1a2b58bb079f886cb817d40": {
                "Name": "ddev-ssh-agent",
                "EndpointID": "9dd6f86d23a37cb1d49fc5fa01a2740567cd266ebdf093fd58ac5d0011a7cef3",
                "MacAddress": "02:42:c0:a8:e3:02",
                "IPv4Address": "192.168.227.2/24",
                "IPv6Address": ""
            },
            "24ebd97087ed757793c577b296132b989ef6581ca68a0b20aac584c7297ab4ad": {
                "Name": "ddev-router",
                "EndpointID": "e2fa5cc4da449c3746917c363c73bd711982d88dd97c8432713f8951f225c922",
                "MacAddress": "02:42:c0:a8:e3:05",
                "IPv4Address": "192.168.227.5/24",
                "IPv6Address": ""
            },
            "a4b7266ba25e2f0eeaaa93eea2182dcc64caa84ff0114e78f51cf4461a389525": {
                "Name": "ddev-donations-web",
                "EndpointID": "859647ede272356b6330a5419f43a92edb91af17c7e712d23e5afc1d402beedc",
                "MacAddress": "02:42:c0:a8:e3:03",
                "IPv4Address": "192.168.227.3/24",
                "IPv6Address": ""
            },
            "b5d5debad4506e508ee4558a300610f591d28639d7e24683ea9a52ca3a14ed6f": {
                "Name": "ddev-donations-db",
                "EndpointID": "e4d4a02c877b86292ed6c63dc4ca58f16df3a8305364fda0621803836b239439",
                "MacAddress": "02:42:c0:a8:e3:04",
                "IPv4Address": "192.168.227.4/24",
                "IPv6Address": ""
            }
        },
        "Options": {},
        "Labels": {}
    },
    {
        "Name": "host",
        "Id": "d97be534fb66f4066254ec33bdff25e091849f617b0e9d58cda6fd2d0484f24c",
        "Created": "2023-07-24T14:42:29.927887083Z",
        "Scope": "local",
        "Driver": "host",
        "EnableIPv6": false,
        "IPAM": {
            "Driver": "default",
            "Options": null,
            "Config": []
        },
        "Internal": false,
        "Attachable": false,
        "Ingress": false,
        "ConfigFrom": {
            "Network": ""
        },
        "ConfigOnly": false,
        "Containers": {},
        "Options": {},
        "Labels": {}
    },
    {
        "Name": "none",
        "Id": "b159031a67f9e9191ad5be109ed77430a6ab0f33fb4de28f4961e6a4caed06dd",
        "Created": "2023-07-24T14:42:29.923627583Z",
        "Scope": "local",
        "Driver": "null",
        "EnableIPv6": false,
        "IPAM": {
            "Driver": "default",
            "Options": null,
            "Config": []
        },
        "Internal": false,
        "Attachable": false,
        "Ingress": false,
        "ConfigFrom": {
            "Network": ""
        },
        "ConfigOnly": false,
        "Containers": {},
        "Options": {},
        "Labels": {}
    }
]

All 16 created in the same second with different subnets.

@rfay
Copy link
Member

rfay commented Jul 26, 2023

Error response from daemon: network ddev-npg_default is ambiguous (16 matches found on name) has been reported elsewhere, doesn't seem like what you were saying before:

Nobody seems to be able to recreate it or figure out what's doing it. Appears to be related to Docker Desktop? But now you're on OrbStack? Or did you switch back?

@pbowyer
Copy link
Author

pbowyer commented Jul 26, 2023

Still on orbstack. I was seeing the same on Docker Desktop (I'm the most recent comment on #4958 )

@rfay
Copy link
Member

rfay commented Jul 26, 2023

DDEV deletes its networks on ddev stop and ddev poweroff.

What's your workflow? Do you possibly do something that doesn't include "stop"? Perhaps repeatedly doing ddev start ?

I don't really understand why this odd behavior is happening to just a scattered few people.

As you know it's fixable with docker network prune but it sure would be nice to know what makes it happen.

@pbowyer
Copy link
Author

pbowyer commented Jul 26, 2023

And yes running vite on the host and spinning up its in-built dev server on port 5173 may be coincidence rather than cause. I thought I had a reproducer there.

What's your workflow? Do you possibly do something that doesn't include "stop"? Perhaps repeatedly doing ddev start ?

I do ddev start and sometimes put the laptop (M1 MBP) to sleep with it still running, and other times do ddev stop or ddev poweroff before I do. And then ddev start to get it going again. I'll have run ddev start a second time sometimes I'm sure, but usually know not to :)

@rfay rfay changed the title Vite on host breaks ddev-router (Orbstack Docker Network Trouble) Multiple ambiguous docker networks created Jul 26, 2023
@rfay
Copy link
Member

rfay commented Jul 26, 2023

There's actually nothing wrong with ddev start multiple times. I'm just trying to understand if there might be some workflow that triggers this.

I sleep/poweroff laptop all the time without even stopping projects. Never have seen this on macOS or WSL2. Obviously it happens!

I just experimented with a few sites and saw only correct behavior with networks being deleted on stop.

Maybe it does have something to do with the vite service, that would seem strange.

Please do occasional docker network ls to see if you can catch it in the act.

@pbowyer
Copy link
Author

pbowyer commented Jul 26, 2023

After a poweroff which removed all the networks, I've done a dozen starts/stops in the last 5 minutes and it's not happened.

I plug into an USB-C Anker hub connected to ethernet at my desk and then use wifi the rest of the time. I'll see if it happens without the network interfaces changing (I assume they do) - been trying that out now but nothing bad happening whichever way

@rfay
Copy link
Member

rfay commented Jul 26, 2023

It looks to me like the suspicious place for this is https://github.com/ddev/ddev/blob/master/pkg/dockerutil/dockerutils.go#L36-L78

and

// NetExists checks to see if the docker network for ddev exists.
func NetExists(client *docker.Client, name string) bool {
nets, _ := client.ListNetworks()
for _, n := range nets {
if n.Name == name {
return true
}
}
return false
}

The only thing I can think is if NetExists() isn't working correctly.

@rfay
Copy link
Member

rfay commented Jul 26, 2023

Oh, it can also be a dangling container which is using the network and prevents it from being deleted. I think we saw that in an earlier dump from you? You'll want to watch carefully for that, and when it happens, do a docker ps -a to understand what's going on.

@rfay
Copy link
Member

rfay commented Aug 4, 2023

  • One thing we can do for that case is give a label/tag to ddev-created networks and remove them on ddev poweroff after all containers are gone. It does seem like this must be triggered by containers that are using the specified network and not properly stopped
  • Another thing to do is to delete the named network when we're about to create one, or not create it if it exists.
  • It seems this must be a docker bug anyway?

@pbowyer
Copy link
Author

pbowyer commented Aug 6, 2023

Hiya, I have continued to experiment and write up notes. I have uncovered 2 OrbStack issues but not yet got reproducers to be able to report them to Orbstack. See what you think in case one of them involves ddev.

Issue 1: PhpStorm and Orbstack interplay

This only happens with particular PhpStorm projects. Presumably ones that try to run something inside the Docker Container automatically. It doesn't involve the ddev plugin as I've tried it installed and removed.

What happens is when my ddev project is not running and I open PhpStorm, it does the following:

docker ps -a
CONTAINER ID   IMAGE                               COMMAND                 CREATED        STATUS                  PORTS     NAMES
dbcd138aabc7   ddev/ddev-ssh-agent:v1.22.0-built   "/entry.sh ssh-agent"   12 hours ago   Up 12 hours (healthy)             ddev-ssh-agent
f3fde3ba6d5f   422dec05bb87                        "/bin/sh"               11 days ago    Created                           phpstorm_helpers_PS-231.9225.18

> docker network ls
NETWORK ID     NAME           DRIVER    SCOPE
ccb41cd50c43   bridge         bridge    local
012df10b2e38   ddev_default   bridge    local
d97be534fb66   host           host      local
b159031a67f9   none           null      local

### I open my PhpStorm project

> docker ps -a
CONTAINER ID   IMAGE                                   COMMAND                 CREATED         STATUS                  PORTS     NAMES
16df75968a0e   ddev/ddev-webserver:v1.22.0-npg-built   "/pre-start.sh"         4 seconds ago   Created                           ddev-npg-web
dbcd138aabc7   ddev/ddev-ssh-agent:v1.22.0-built       "/entry.sh ssh-agent"   12 hours ago    Up 12 hours (healthy)             ddev-ssh-agent
f3fde3ba6d5f   422dec05bb87                            "/bin/sh"               11 days ago     Created                           phpstorm_helpers_PS-231.9225.18

> docker network ls
NETWORK ID     NAME               DRIVER    SCOPE
ccb41cd50c43   bridge             bridge    local
5954c8413085   ddev-npg_default   bridge    local
32eeba2c017d   ddev-npg_default   bridge    local
5942e2cae323   ddev-npg_default   bridge    local
cadcd530431b   ddev-npg_default   bridge    local
cbca75a1f7ae   ddev-npg_default   bridge    local
5c507064878d   ddev-npg_default   bridge    local
62e74d9579c1   ddev-npg_default   bridge    local
93129e5da6a4   ddev-npg_default   bridge    local
66ecd98e027a   ddev-npg_default   bridge    local
cb46373f3e67   ddev-npg_default   bridge    local
2eba9c1129cb   ddev-npg_default   bridge    local
9d8c1f425c46   ddev-npg_default   bridge    local
63fad463bf4d   ddev-npg_default   bridge    local
c1eb0f28b8e9   ddev-npg_default   bridge    local
bc6e4aa78f88   ddev-npg_default   bridge    local
63ac3f654513   ddev-npg_default   bridge    local
012df10b2e38   ddev_default       bridge    local
d97be534fb66   host               host      local
b159031a67f9   none               null      local

To fix this problem I can run ddev stop which cleans everything up perfectly:

> ddev stop
Project npg is already stopped.
 Container ddev-npg-web  Stopped
 Container ddev-npg-web  Removed
 Network ddev-npg_default  Removed
 Network ddev-npg_default  Removed
 Network ddev-npg_default  Removed
 Network ddev-npg_default  Removed
 Network ddev-npg_default  Removed
 Network ddev-npg_default  Removed
 Network ddev-npg_default  Removed
 Network ddev-npg_default  Removed
 Network ddev-npg_default  Removed
 Network ddev-npg_default  Removed
 Network ddev-npg_default  Removed
 Network ddev-npg_default  Removed
 Network ddev-npg_default  Removed
 Network ddev-npg_default  Removed
 Network ddev-npg_default  Removed
 Network ddev-npg_default  Removed
Project npg has been stopped.

> docker ps -a
CONTAINER ID   IMAGE                               COMMAND                 CREATED        STATUS                  PORTS     NAMES
dbcd138aabc7   ddev/ddev-ssh-agent:v1.22.0-built   "/entry.sh ssh-agent"   12 hours ago   Up 12 hours (healthy)             ddev-ssh-agent
f3fde3ba6d5f   422dec05bb87                        "/bin/sh"               11 days ago    Created                           phpstorm_helpers_PS-231.9225.18

> docker network ls
NETWORK ID     NAME           DRIVER    SCOPE
ccb41cd50c43   bridge         bridge    local
012df10b2e38   ddev_default   bridge    local
d97be534fb66   host           host      local
b159031a67f9   none           null      local

This is a nuisance but now I know the fix, I can work around it.

Issue 2: Subfolders, mutagen and project confusion

I only discovered this one late last night so haven't yet had a chance to reproduce with Docker Desktop to confirm it's an OrbStack issue (I'll edit this message when I do)

I had an already run ddev start for the project.
I cd'd into a subfolder, selected the wrong command from my history and ran ddev start again.

This got me into a broken state, because I got (message from a reproducer this morning):

Starting npg...
Using custom mysql configuration: [/Users/peter/npg/.ddev/mysql/my-npg.cnf]
Custom configuration is updated on restart.
If you don't see your custom configuration taking effect, run 'ddev restart'.
 Container ddev-npg-elasticsearch  Running
 Container ddev-npg-web  Running
 Container ddev-npg-db  Recreate
 Container ddev-npg-db  Recreated
 Container ddev-npg-db  Started
Failed waiting for web/db containers to become ready: web container failed: log=[{2023-08-06 09:49:05.740120147 +0000 UTC 2023-08-06 09:49:05.817996948 +0000 UTC 1 /var/www/html:OK mailhog:FAILED phpstatus:FAILED } {2023-08-06 09:49:06.826370476 +0000 UTC 2023-08-06 09:49:06.894583754 +0000 UTC 1 /var/www/html:OK mailhog:FAILED phpstatus:FAILED } {2023-08-06 09:49:07.898742279 +0000 UTC 2023-08-06 09:49:07.931850604 +0000 UTC 1 /var/www/html:OK mailhog:FAILED phpstatus:FAILED } {2023-08-06 09:49:08.935492139 +0000 UTC 2023-08-06 09:49:08.958825234 +0000 UTC 1 /var/www/html:OK mailhog:FAILED phpstatus:FAILED } {2023-08-06 09:49:09.961078338 +0000 UTC 2023-08-06 09:49:09.991694085 +0000 UTC 1 /var/www/html:OK mailhog:FAILED phpstatus:FAILED }], err=container /ddev-npg-web-run-5aec3df7b5c9 unhealthy: [{2023-08-06 09:49:05.740120147 +0000 UTC 2023-08-06 09:49:05.817996948 +0000 UTC 1 /var/www/html:OK mailhog:FAILED phpstatus:FAILED } {2023-08-06 09:49:06.826370476 +0000 UTC 2023-08-06 09:49:06.894583754 +0000 UTC 1 /var/www/html:OK mailhog:FAILED phpstatus:FAILED } {2023-08-06 09:49:07.898742279 +0000 UTC 2023-08-06 09:49:07.931850604 +0000 UTC 1 /var/www/html:OK mailhog:FAILED phpstatus:FAILED } {2023-08-06 09:49:08.935492139 +0000 UTC 2023-08-06 09:49:08.958825234 +0000 UTC 1 /var/www/html:OK mailhog:FAILED phpstatus:FAILED } {2023-08-06 09:49:09.961078338 +0000 UTC 2023-08-06 09:49:09.991694085 +0000 UTC 1 /var/www/html:OK mailhog:FAILED phpstatus:FAILED }]
 Container ddev-router  Running
Failed to start npg: container(s) failed to become healthy before their configured timeout or in 120 seconds. This may be just a problem with the healthcheck and not a functional problem. (container /ddev-npg-web-run-5aec3df7b5c9 is unhealthy: [{2023-08-06 09:49:07.898742279 +0000 UTC 2023-08-06 09:49:07.931850604 +0000 UTC 1 /var/www/html:OK mailhog:FAILED phpstatus:FAILED } {2023-08-06 09:49:08.935492139 +0000 UTC 2023-08-06 09:49:08.958825234 +0000 UTC 1 /var/www/html:OK mailhog:FAILED phpstatus:FAILED } {2023-08-06 09:49:09.961078338 +0000 UTC 2023-08-06 09:49:09.991694085 +0000 UTC 1 /var/www/html:OK mailhog:FAILED phpstatus:FAILED } {2023-08-06 09:49:10.996079982 +0000 UTC 2023-08-06 09:49:11.023543498 +0000 UTC 1 /var/www/html:OK mailhog:FAILED phpstatus:FAILED } {2023-08-06 09:49:12.028005809 +0000 UTC 2023-08-06 09:49:12.098777246 +0000 UTC 1 /var/www/html:OK mailhog:FAILED phpstatus:FAILED }])

I suspect ddev destroy would've been the easiest way to fix but I needed to backup the database before running that... oops.

I tried a few things and in the end powered off ddev and then manually deleted the volume npg_project_mutagen. After that ddev start worked and I backed up the DB.

Then I ran ddev start again in a subfolder (what can I say, I was tired). Same thing happened.

This time I ran ddev config --performance-mode none.
Now when I accidentally run ddev start in a subfolder it prints

Starting npg...
Using custom mysql configuration: [/Users/peter/npg/.ddev/mysql/my-npg.cnf]
Custom configuration is updated on restart.
If you don't see your custom configuration taking effect, run 'ddev restart'.
 Container ddev-npg-elasticsearch  Running
 Container ddev-npg-web  Running
 Container ddev-npg-db  Recreate
 Container ddev-npg-db  Recreated
 Container ddev-npg-db  Started
 Container ddev-router  Running
Successfully started npg
Project can be reached at https://npg.ddev.site https://127.0.0.1:32802

and more importantly, the web container still works afterwards.

Aside: startup time

Even on a successful run the containers start and then there's a 15s+ pause before the "Successfully started" message is printed. Is there any way I can see what's going on in that time?

@rfay
Copy link
Member

rfay commented Aug 6, 2023

Great work studying it!

Even on a successful run the containers start and then there's a 15s+ pause before the "Successfully started" message is printed. Is there any way I can see what's going on in that time?

export DDEV_DEBUG=true

or if desperate and you really want to read lots of stuff

export DDEV_VERBOSE=true

and then you can see exactly what's going on.

I think your study here is going to get us somewhere... that it may have to do with PhpStorm. When PhpStorm uses the .ddev/.ddev-docker-compose-full.yaml, it's doing it without any input from DDEV. DDEV thinks it's already done its job (or perhaps a project hasn't started yet), but PhpStorm is using raw docker-compose. So maybe that's our path. Thank you for the great study and debugging, I think we're going to get somewhere!

With regard to your ddev start in a subfolder, I think that's not the problem. I think you've accidentally run ddev config in a subfolder. ddev config gives a warning in that case, but perhaps you found a way to create a .ddev/config.yaml previously in a subdirectory:

rfay@rfay-tag1-m1:~/workspace/d10/junk$ ddev config --auto
It usually does not make sense to `ddev config` in a subdirectory of an existing project. Is it possible you wanted to `ddev config` in parent directory /Users/rfay/workspace/d10?

but `ddev start definitely knows how to find the correct project, doesn't get confused about this.

@pbowyer
Copy link
Author

pbowyer commented Aug 7, 2023

Thanks Randy, will check tomorrow if I've got more than one .ddev/ folder in the project!

@stasadev
Copy link
Member

Interestingly, the ddev_default network never encounters this problem because it is always created before any docker-compose.yaml file is called.

I see this workaround is mentioned here:

Maybe if the project default network was created beforehand, it could resolve this issue 🤔

@rfay
Copy link
Member

rfay commented Aug 29, 2023

Thanks for spotting that issue @stasadev - I wonder why this doesn't happen more. The project network could probably be created externally. It makes some things awkward and the docker-compose externally becomes harder (as with PhpStorm's plugin for ddev) - An experimental PR would be welcome.

@stasadev
Copy link
Member

So far, so good.

It makes some things awkward and the docker-compose externally becomes harder (as with PhpStorm's plugin for ddev).

PhpStorm's plugin sees my database with the project's external network.

I'll be using the binary from #5305 with my projects for a week or so to see if there are any issues and will report my results here.

@rfay
Copy link
Member

rfay commented Aug 30, 2023

Thanks @stasadev - have you been able to demonstrate this problem in your own environment?

@stasadev
Copy link
Member

It just happens from time to time.
I had this problem maybe six months ago, then it went away, and now I see it again several times a week.

@rfay
Copy link
Member

rfay commented Aug 30, 2023

Great that you see it! Have you figured out anything about your workflow that might trigger it? Remind me your OS and environment...

@stasadev
Copy link
Member

My workflow:

  • I always do ddev poweroff when I shutdown/reboot my PC
  • I can start/stop my projects several times during the day

Usually such a problem occurs:

  • when I boot my PC, there is no running project, and I start something
  • when I'm working on a project, then stop it (so far so good), and start it again after a few hours
$ ddev version
 ITEM             VALUE                                                                         
 DDEV version     v1.22.1-34-gd30e558b6                                                         
 architecture     amd64                                                                         
 db               ddev/ddev-dbserver-mariadb-10.4:20230806_mysql_config_windows                 
 ddev-ssh-agent   ddev/ddev-ssh-agent:v1.22.0                                                   
 docker           24.0.5                                                                        
 docker-compose   v2.20.3                                                                       
 docker-platform  Manjaro Linux                                                                 
 mutagen          0.17.2                                                                        
 os               linux                                                                         
 router           ddev/ddev-traefik-router:20230816_traefik_image                               
 web              ddev/ddev-webserver:20230720_ted933_doc_installation_ubuntu_apt_vulnerability

@rfay
Copy link
Member

rfay commented Aug 30, 2023

I wonder if it could have something to do with the Arch build of docker or something. But assuming the problem is docker-compose, that wouldn't matter because we provide our own docker-compose (I assume you use the defaults, and this report is from your PR, which would be using v2.20.3.)

@stasadev
Copy link
Member

I wonder if it could have something to do with the Arch build of docker or something.

Seeing as other people have this problem on Mac, I'd rather generalize the problem.

Also, when I see 100+ likes on a comment about duplicated docker networks (even if not everyone who liked it uses DDEV), it makes me think this problem is common:

I remember having such a problem with:

ddev 1.21.6 (Mar 10 2023) 
containerd 1.7.0
docker 23.0.1 - I think I didn't have any issues with 20.10.23
docker-buildx 0.10.4
docker-compose v2.17.0 and later

Then it was all good with:

ddev 1.22.0 (Jul 24 2023)
containerd 1.7.2
docker 24.0.5
docker-buildx 0.11.0
docker-compose v2.20.0

And started again with:

ddev 1.22.1 (Aug 4 2023)
containerd 1.7.2
docker 24.0.5
docker-buildx 0.11.2
docker-compose v2.20.0

It is a mystery to me where the cause of the problem lies, because there are also many dependencies for the mentioned programs.

@kevinquillen
Copy link
Contributor

kevinquillen commented Nov 1, 2023

I am using the PHPStorm extension - and the problem happens for me on MacOS AND Linux (with PHPStorm + plugin). I did not get to try the updated release, sorry - but this is probably a good lead.

edit: my plugin is now disabled. Will report if this keeps happening

@stasadev
Copy link
Member

stasadev commented Nov 1, 2023

I mostly have DDEV integration disabled (I only use it when I need a database connection).
The error happened even when I only had a terminal running (Konsole in my case) and nothing else.

Regarding @pbowyer's description - I agree that it could also be related to the DDEV integration, because I haven't seen that many (16 matches) duplicate networks at once. My maximum is 2 matches.

@kevinquillen
Copy link
Contributor

I've had as many as 12 before.

@pbowyer
Copy link
Author

pbowyer commented Nov 1, 2023

I finally tested @stasadev work today using the latest nightly on ARM64 with OrbStack as the backend, and so far it seems to have fixed the problem. I'll keep testing.

@pbowyer
Copy link
Author

pbowyer commented Nov 7, 2023

I had this problem happen to me again today, using a nightly build. Command outputs slightly edited to hide the company I'm working for:

peter@MBP2021 ~/p/proj1 (master)> ddev start

 TIP OF THE DAY
 `ddev npm` is the right way to run npm commands in your web container.

Starting proj1...
Using custom apache configuration in /Users/peter/projects/proj1/.ddev/apache/apache-site.conf
Using custom MySQL configuration: [/Users/peter/projects/proj1/.ddev/mysql/sql_mode.cnf]
Custom configuration is updated on restart.
If you don't see your custom configuration taking effect, run 'ddev restart'.
Building project images...
.....................Project images built in 30s.
multiple networks with name "ddev-proj1_default" were found. Use network ID as `name` to avoid ambiguity
Failed to start proj1: composeCmd failed to run 'COMPOSE_PROJECT_NAME=ddev-proj1 docker-compose -f /Users/peter/projects/proj1/.ddev/.ddev-docker-compose-full.yaml up -d', action='[]', err='exit status 1', stdout='', stderr='multiple networks with name "ddev-proj1_default" were found. Use network ID as `name` to avoid ambiguity'

peter@MBP2021 ~/p/proj1 (master) [1]> ddev -v
ddev version v1.22.4-14-gd8ebc7d12

peter@MBP2021 ~/p/proj1 (master)> docker network ls
NETWORK ID     NAME                            DRIVER    SCOPE
c9892499e5ef   bridge                          bridge    local
c5b138ab8ffd   ddev-proj2_default            bridge    local
83d2df694367   ddev-proj2_default            bridge    local
3c1d2c1ba6d8   ddev-proj2_default            bridge    local
33073972c2e8   ddev-proj1_default   bridge    local
7b06ed1c13bd   ddev-proj1_default   bridge    local
50ad5c8cf7fe   ddev-proj1_default   bridge    local
5a70857db3ae   ddev-proj1_default   bridge    local
52fefa2aacbb   ddev-proj1_default   bridge    local
478d09ae9cae   ddev-proj1_default   bridge    local
5c5364690a4f   ddev_default                    bridge    local
d97be534fb66   host                            host      local
b159031a67f9   none                            null      local

peter@MBP2021 ~/p/proj1 (master)> docker ps -a
CONTAINER ID   IMAGE                                       COMMAND                  CREATED        STATUS                PORTS                                                                                                                                              NAMES
96c1137e8a97   ddev/ddev-webserver:v1.22.3-proj2-built   "/pre-start.sh"          4 days ago     Created                                                                                                                                                                  ddev-proj2-web
afbdaa838b9e   ddev/ddev-traefik-router:v1.22.4            "/entrypoint.sh --co…"   6 days ago     Up 6 days (healthy)   127.0.0.1:80->80/tcp, 127.0.0.1:443->443/tcp, 127.0.0.1:8025-8026->8025-8026/tcp, 127.0.0.1:9200-9201->9200-9201/tcp, 127.0.0.1:10999->10999/tcp   ddev-router
f4a8531b711e   ddev/ddev-ssh-agent:v1.22.4-built           "/entry.sh ssh-agent"    6 days ago     Up 6 days (healthy)                                                                                                                                                      ddev-ssh-agent
f3fde3ba6d5f   422dec05bb87                                "/bin/sh"                3 months ago   Created                                                                                                                                                                  phpstorm_helpers_PS-231.9225.18

From this it looks to have also happened to another project, proj2, that I worked on last week but didn't start the environment for.

Edit: this time ddev poweroff wasn't enough to clear it. I had to resort to

docker network ls | grep ddev-proj1_default | awk '{ print $1; }' | xargs docker network rm

@stasadev
Copy link
Member

stasadev commented Nov 7, 2023

@pbowyer thanks for the feedback, I think I understand the problem better now.

I have a few ideas to fix this since I can now control the project network:

  1. When removing a network in ddev poweroff, look for the network ID, not the network name.
  2. There is a CheckDuplicate option that I can use when creating a network.

I will create a PR for this today or tomorrow.

Edit: I decided not to use CheckDuplicate as this option will be removed in Docker 25 anyway.

@stasadev
Copy link
Member

stasadev commented Nov 7, 2023

I've created a new PR #5508 where I've done everything I can to resolve this issue once and for all.

The idea is to run docker network rm under the hood to remove duplicates no matter what the user tries to do.

I've created a reproducible broken binary in the Manual Testing Instructions, so anyone who wants to test duplicate networks can easily do so.

And then use a fixed binary from the bot comment to see how these duplicates will be removed.

@pbowyer
Copy link
Author

pbowyer commented Nov 10, 2023

😁 @stasadev Thank you! 😁

I opened "proj3" in PhpStorm, a project which has always caused trouble. Your patch worked around the problem and ddev ran without error. Here's the output:

peter@MBP2021 ~/p/n/proj3_web (develop)> docker ps -a
CONTAINER ID   IMAGE                                                    COMMAND                  CREATED         STATUS                    PORTS                                                                                                                                              NAMES
8674a91d7e39   ddev/ddev-webserver:v1.22.3-proj3-built                  "/pre-start.sh"          6 minutes ago   Created                   8025/tcp, 127.0.0.1:32873->80/tcp, 127.0.0.1:32872->443/tcp                                                                                        ddev-proj3-web
8db96985647b   ddev/ddev-webserver:v1.22.3-proj2-built                  "/pre-start.sh"          26 hours ago    Up 26 hours (unhealthy)   8025/tcp, 127.0.0.1:32871->80/tcp, 127.0.0.1:32870->443/tcp                                                                                        ddev-proj2-web
f3bb7f78119b   ddev/ddev-traefik-router:v1.22.4                         "/entrypoint.sh --co…"   32 hours ago    Up 32 hours (healthy)     127.0.0.1:80->80/tcp, 127.0.0.1:443->443/tcp, 127.0.0.1:8025-8026->8025-8026/tcp, 127.0.0.1:9200-9201->9200-9201/tcp, 127.0.0.1:10999->10999/tcp   ddev-router
da7e66ff0873   ddev/ddev-webserver:20231030_apotek_xsl-proj1-built   "/pre-start.sh"          32 hours ago    Up 32 hours (healthy)     8025/tcp, 127.0.0.1:32866->80/tcp, 127.0.0.1:32865->443/tcp                                                                                        ddev-proj1-web
5a8880af8276   ddev/ddev-dbserver-mysql-5.7:v1.22.4-proj1-built      "/docker-entrypoint.…"   32 hours ago    Up 32 hours (healthy)     127.0.0.1:32867->3306/tcp                                                                                                                          ddev-proj1-db
c40fb6f697bb   elasticsearch:7.17.6                                     "/bin/tini -- /usr/l…"   32 hours ago    Up 32 hours (healthy)     9200/tcp, 9300/tcp                                                                                                                                 ddev-proj1-elasticsearch
522cbee3de8c   ddev/ddev-ssh-agent:v1.22.4-built                        "/entry.sh ssh-agent"    2 days ago      Up 2 days (healthy)                                                                                                                                                          ddev-ssh-agent
f3fde3ba6d5f   422dec05bb87                                             "/bin/sh"                3 months ago    Created                                                                                                                                                                      phpstorm_helpers_PS-231.9225.18

peter@MBP2021 ~/p/n/proj3_web (develop)> docker network ls
NETWORK ID     NAME                    DRIVER    SCOPE
c9892499e5ef   bridge                  bridge    local
fe39b2ee0a55   ddev-proj2_default      bridge    local
ffda021408e2   ddev-proj2_default      bridge    local
c80a7912b917   ddev-proj2_default      bridge    local
44f371fa1e96   ddev-proj1_default      bridge    local
7f2967d38e63   ddev-proj3_default      bridge    local
2fb6fb814c36   ddev-proj3_default      bridge    local
263458a8b5ab   ddev-proj3_default      bridge    local
25d9f1effd01   ddev-proj3_default      bridge    local
2659954b4d51   ddev-proj3_default      bridge    local
b69e5054a088   ddev-proj3_default      bridge    local
15540db6781a   ddev-proj3_default      bridge    local
b71d97dac547   ddev-proj3_default      bridge    local
e426cb88273e   ddev-proj3_default      bridge    local
ce4f168932e0   ddev-proj3_default      bridge    local
721ef5822b25   ddev-proj3_default      bridge    local
657963eb0e1f   ddev-proj3_default      bridge    local
cf621c9c476d   ddev-proj3_default      bridge    local
7431a6e5d81b   ddev-proj3_default      bridge    local
3f698f1f2e8e   ddev-proj3_default      bridge    local
12dc5898b6c0   ddev-proj3_default      bridge    local
4fd863eaf1d5   ddev_default            bridge    local
d97be534fb66   host                    host      local
b159031a67f9   none                    null      local

peter@MBP2021 ~/p/n/proj3_web (develop)> ddev -v
ddev version v1.22.5-alpha1-4-g8ccbe6ba1

peter@MBP2021 ~/p/n/proj3_web (develop)> ddev start

 TIP OF THE DAY
 `ddev snapshot -a` will back up all your project databases.

Starting proj3...
Network ddev-proj3_default removed
Network ddev-proj3_default removed
Network ddev-proj3_default removed
Network ddev-proj3_default removed
Network ddev-proj3_default removed
Network ddev-proj3_default removed
Network ddev-proj3_default removed
Network ddev-proj3_default removed
Network ddev-proj3_default removed
Network ddev-proj3_default removed
Network ddev-proj3_default removed
Network ddev-proj3_default removed
Network ddev-proj3_default removed
Network ddev-proj3_default removed
Network ddev-proj3_default removed
Using custom MySQL configuration: [/Users/peter/projects/proj3/proj3_web/.ddev/mysql/my-proj3.cnf]
Using custom PHP configuration: [/Users/peter/projects/proj3/proj3_web/.ddev/php/proj3-php.ini]
Custom configuration is updated on restart.
If you don't see your custom configuration taking effect, run 'ddev restart'.
v1.22.4: Pulling from ddev/ddev-dbserver-mariadb-10.5
[snip]
Status: Downloaded newer image for ddev/ddev-dbserver-mariadb-10.5:v1.22.4
docker.io/ddev/ddev-dbserver-mariadb-10.5:v1.22.4
Building project images...
Project images built in 1s.
 Container ddev-proj3-web  Created
 Container ddev-proj3-elasticsearch  Created
 Container ddev-proj3-db  Created
 Container ddev-proj3-elasticsearch  Started
 Container ddev-proj3-db  Started
 Container ddev-proj3-web  Started
You have Mutagen enabled and your 'php' project type doesn't have `upload_dirs` set.
For faster startup and less disk usage, set upload_dirs to where your user-generated files are stored.
If this is intended you can disable this warning with `ddev config --disable-upload-dirs-warning`.
Starting Mutagen sync process...
.......................................Mutagen sync flush completed in 40s.
For details on sync status 'ddev mutagen st proj3 -l'
Waiting for web/db containers to become ready: [web db]
Starting ddev-router if necessary...
 Container ddev-router  Running
Waiting for additional project containers to become ready...
All project containers are now ready.
Successfully started proj3
Project can be reached at https://proj3.ddev.site https://127.0.0.1:32872
Instrumentation is opted in, but AmplitudeAPIKey is not available. This usually means you have a locally-built ddev binary or one from a PR build. It's not an error. Please report it if you're using an official release build.

I would dearly love Docker/OrbStack (which I use)/PhpStorm to stop creating unhealthy containers and duplicate networks, but thanks to you I don't have to think about it each time I run ddev 😀

@rfay
Copy link
Member

rfay commented Nov 10, 2023

I do think it's possible that this issue is caused by the PhpStorm extension doing the regular ddev describe -j while people are doing something else on the command line, like ddev stop or ddev start. I think this has only been reported by PhpStorm users who use the extension.

So it may be that the actual fix is for ddev to use some kind of synchronization to make sure only one command can be run at a time.

@rfay
Copy link
Member

rfay commented Nov 10, 2023

@rfay
Copy link
Member

rfay commented Nov 10, 2023

A related fix is short-cutting ddev describe when the project is doing something else.

@nico-loeber would love your feedback on this. Is ddev describe -j the only likely behavior or the PhpStorm extension that could be related, that is usually happening?

And to all of you: Does this behavior go away if you turn off the polling of status in the PhpStorm extension?

@pbowyer
Copy link
Author

pbowyer commented Nov 10, 2023

I've disabled the PhpStorm DDEV extension and will text next week and see what happens.

@rfay
Copy link
Member

rfay commented Nov 10, 2023

You don't actually have to disable the extension, just its polling behavior.

image

@rfay rfay closed this as completed in fe3abca Nov 10, 2023
@pbowyer
Copy link
Author

pbowyer commented Nov 13, 2023

It's not the DDEV plugin for PHPStorm. I'd kept the plugin disabled, and today I opened a project in PHPStorm before running ddev start and duplicate networks and a "Created" (soon to be in an unhealthy state) container appeared

> docker network ls
NETWORK ID     NAME                   DRIVER    SCOPE
c9892499e5ef   bridge                 bridge    local
ac789aeb0b18   ddev-myproj1_default   bridge    local
596f0a24338d   ddev-myproj1_default   bridge    local
7e4d388ddc88   ddev-myproj1_default   bridge    local
85bb170c5c6d   ddev_default           bridge    local
d97be534fb66   host                   host      local
b159031a67f9   none                   null      local

> docker ps -a
CONTAINER ID   IMAGE                                       COMMAND                  CREATED          STATUS                    PORTS                                                                                                          NAMES
b2a5d882a58c   ddev/ddev-webserver:v1.22.3-myproj1-built   "/pre-start.sh"          2 minutes ago    Created                   8025/tcp, 127.0.0.1:32894->80/tcp, 127.0.0.1:32893->443/tcp                                                    ddev-myproj1-web
e8e72e8ba0e0   ddev/ddev-traefik-router:v1.22.4            "/entrypoint.sh --co…"   44 minutes ago   Up 44 minutes (healthy)   127.0.0.1:80->80/tcp, 127.0.0.1:443->443/tcp, 127.0.0.1:8025-8026->8025-8026/tcp, 127.0.0.1:10999->10999/tcp   ddev-router
5000b069f375   ddev/ddev-ssh-agent:v1.22.4-built           "/entry.sh ssh-agent"    13 hours ago     Up 13 hours (healthy)                                                                                                                    ddev-ssh-agent
f3fde3ba6d5f   422dec05bb87                                "/bin/sh"                3 months ago     Created  

@rfay
Copy link
Member

rfay commented Nov 13, 2023

Remind me what DDEV version you were using for that test?

Please say more about "today I opened a project in PHPStorm before running ddev start and duplicate networks and a "Created" (soon to be in an unhealthy state) container appeared". Are you saying that you had nothing running, and you just opened a project in PhpStorm and things started happening? Could. you please do a docker network ls in a terminal window before starting PhpStorm next time?

@pbowyer
Copy link
Author

pbowyer commented Nov 13, 2023

Hi @rfay, that was using ddev version v1.22.5-alpha1-4-g8ccbe6ba1.

DDEV was running and I finished working on one project, closed its PhpStorm window and ran ddev stop for that project. I then opened myproj1 in PhpStorm. After that, I went and looked at the two docker commands above, because this project usually causes the problem.

I will certainly run the docker commands before and after next time. The problem won't repeat now (just tried it) - it always needs a delay, which makes me think it's linked to something PhpStorm rechecks after a certain amount of time - and tries to do inside the container e.g. checking for composer package updates.

@pbowyer
Copy link
Author

pbowyer commented Nov 13, 2023

This ticket looks like it could be the same issue: https://youtrack.jetbrains.com/issue/WI-53533/Autostart-docker-containers.

I'll test out the workarounds in it.

@rfay
Copy link
Member

rfay commented Nov 13, 2023

Wow, if PhpStorm is trying to start containers that could cause all kinds of havoc.

@stasadev
Copy link
Member

@pbowyer could you try the artifacts from #5533 (comment) ?

I decided that making the project networks external was too intrusive and found a way to make them internal as before, but with the same duplicate check.

I hope this change will have the same effect with a simpler approach.

@stasadev
Copy link
Member

I tested Docker 25.0.0-beta.1

The only difference I've noticed is that with Docker 24 you can have duplicates and with Docker 25 you don't and you'll still see a different error this time if a duplicate tries to be created.

Docker 24.0.7, DDEV v1.22.4

$ ddev start
...
Failed to start your-project: container(s) failed to become healthy before their configured timeout or in 120 seconds.

// trying to start the project again will have the same error, because there are duplicates

Docker 25.0.0-beta.1, DDEV v1.22.4

$ ddev start
...
API error (409): network with name ddev-your-project_default already exists

// trying to start the project again might work if "docker-compose up" decides not to create a duplicate this time

⬆️ I only tested the behavior of Docker 25 programmatically with https://github.com/fsouza/go-dockerclient.


I believe that managing the project network with DDEV v1.22.5 will be useful as it will save the user from messing around with errors.

@rfay
Copy link
Member

rfay commented Nov 14, 2023

But docker 25 doesn't solve the problem, just reports it?

@stasadev
Copy link
Member

But docker 25 doesn't solve the problem, just reports it?

That's only my assumption, but I'm going to test it using Docker 25.0.0-beta.1 and DDEV v1.22.4, maybe I am wrong.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants