How can I find out what's going wrong with a ddev container, or see the logs?

半腔热情 提交于 2020-01-15 14:10:52

问题


I'm working on a project using ddev and I don't know how to troubleshoot things because they're hidden in the containers they run in. For example, I've tried ddev logs but it doesn't give me enough information.


回答1:


ddev logs is the first line of investigation. It gets the logs of the web container (both the nginx error log and the php-fpm error log, mixed together).

Extra approaches:

  • You could probably (temporarily) remove any custom nginx/php/mysql configuration that you might have added to the project in the .ddev folder, as those are common culprits.
  • Please make sure you're using the current docker images that match the ddev version you're using. I recommend deleting any "webimage" or "dbimage" lines in your .ddev/config.yaml.
  • ddev logs -f will "follow" the web logs, so you can see what happens when you hit a particular URL.
  • ddev logs -s db (or of course ddev logs -f -s db will show you the logs of the database container (MariaDB logs)
  • Use ddev ssh (for the web container) or ddev ssh -s db (for the db container) to actually go in there and look around. The most important logs are in /var/log/ and /var/log/nginx.

Note that before ddev v0.18.0 it wasn't easy to view the logs of a stopped container (you needed to use docker logs ddev-<project>-web, for example), but in v0.18.0 and forward, ddev logs works on a stopped container.



来源:https://stackoverflow.com/questions/49660210/how-can-i-find-out-whats-going-wrong-with-a-ddev-container-or-see-the-logs

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!