我如何找出ddev容器出了什么问题或查看日志? [英] How can I find out what's going wrong with a ddev container, or see the logs?

查看:82
本文介绍了我如何找出ddev容器出了什么问题或查看日志?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 ddev 进行项目,并且我不知道如何解决问题,因为它们被隐藏在运行它们的容器中。例如,我尝试过 ddev日志,但是它没有提供足够的信息。

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.

推荐答案

ddev日志是调查的第一行。它获取Web容器的日志(nginx错误日志和php-fpm错误日志,混合在一起)。

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).

其他方法:


  • 您可能(暂时)删除任何自定义nginx您可能已经在.ddev文件夹中添加到项目的/ php / mysql配置,因为它们是常见的罪魁祸首。

  • 请确保您使用的是与您正在使用的ddev版本。我建议删除.ddev / config.yaml中的所有 webimage或 dbimage行。

  • ddev日志-f 将关注网络日志,因此您可以看到点击特定URL时发生的情况。

  • ddev日志-s db (当然还有 ddev日志-f -s db 将显示数据库容器的日志(MariaDB日志)

  • 使用 ddev ssh (对于Web容器)或 ddev ssh -s db (用于db容器)实际进入那里并环顾四周,最重要的日志在/ var / log /和/ var / log /中nginx。

  • 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.

请注意,在ddev v0.18.0之前,查看已停止容器的日志并不容易(您需要使用 docker日志ddev-< project> -web ),但在v0.18.0及更高版本中, ddev日志在停止的容器上工作。

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.

这篇关于我如何找出ddev容器出了什么问题或查看日志?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆