ddev: 502 Bad Gateway and then DDev stops working - all projects won't start, "failed to read the CA certificate: unexpected content"
Describe the bug While working on a project, updating twig code, all of a sudden the project will return a 502 bad gateway error in the browser.
Stop Ddev and then run DDEv start and get the following error:
Failed to start project-name: ddev-router failed to become ready: logOutput=, err=container exited, please use `'ddev logs -s ddev-router`` to find out why it failed
running ddev logs outputs this:
Using the local CA at "/root/.local/share/mkcert" ✨
ERROR: failed to read the CA certificate: unexpected content
I then ran ddev poweroff and restarted - got the same issue. Rebooted compuger and got the same issue.
Am unable to work on any projects at this point.
Expected behavior A clear and concise description of what you expected to happen.
Screenshots If applicable, add screenshots to help explain your problem.
Version and configuration information (please complete the following information):
- Host computer OS and Version: Windows 10
- Docker version information 19.03.8
- ddev version information 1.14.2
- config.yaml contents for the misbehaving project – APIVersion: v1.13.1 name: compugen-new type: php docroot: public php_version: “7.3” mysql_version: “5.7” webserver_type: nginx-fpm router_http_port: “80” router_https_port: “443” xdebug_enabled: false additional_hostnames: [] additional_fqdns: [] nfs_mount_enabled: false provider: default use_dns_when_possible: true timezone: “” host_db_port: “32890”
- Do you have any custom configuration (nginx, php, mysql) in the .ddev folder? no
Additional context
This is the full output when running ddev start
λ ddev start
Starting compugen-new...
Building ddev-ssh-agent
Creating ddev-ssh-agent ... done
ssh-agent container is running: If you want to add authentication to the
ssh-agent container, run 'ddev auth ssh' to enable your keys.
Pushing mkcert rootca certs to ddev-global-cache
failed to copy root CA into docker volume: container run failed with exit code 1, output=''
Pushed mkcert rootca certs to ddev-global-cache
Building db
Building web
Creating ddev-compugen-new-db ... done
Creating ddev-compugen-new-dba ... done
Creating ddev-compugen-new-web ... done
Creating ddev-router ... done
Failed to start compugen-new: ddev-router failed to become ready: logOutput=, err=container exited, please use 'ddev logs -s ddev-router` to find
out why it failed
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Comments: 15 (8 by maintainers)
This happened in my ddev version v1.22.4 with Docker Desktop 4.25.2 after renaming my ddev project:
First tried to uninstall and reinstall mkcert as described above. Didn’t help. Then tried to restart Docker Desktop and ddev restart. Now getting invalid SSL cert error in https requests. After a minute or so I’m back to “Bad Gateway” on the same request. Another ddev project on my machine does work fine (SSL cert works), so it must be related to this very project.
Under
.ddev/traefik/certs
and.ddev/traefik/config
I found backup file of the previous project name. I remove those configs and certs. Then did addev restart
. I’m now getting the invalid cert error.Now I’m repeating the mkcert reinstall process:
works now!
This issue happened again. I resolved it by once again following the instructions in this comment https://github.com/drud/ddev/issues/2285#issuecomment-636928527 after restarting docker.
Somebody else reported this, the fix for them was
ddev poweroff
and then restart docker. What version of Docker Desktop for Windows are you using?It’s also possible that somehow you have a corrupted local CA for mkcert to use; the fix for that (if the above doesn’t work) is