search

Home  >  Q&A  >  body text

如何使用docker中的php环境来调试代码

我搭建好php容器,http请求这一环节没有问题。

问题出现在调试。

因为安装了docker我本地已经没有/usr/bin/php文件。

这时候,如果我需要使用php cli来执行一个php,如何操作?

我想,可以ssh进行php容器,然后在容器内执行 /usr/bin/php xxx.php

但是在phpstrom IDE中感觉使用起来不太方便。

然后我看到phpstorm有个 docker的plugin,需要配置个docker-machine

问题来了,我开发环境是ubuntu 16.04

$ docker-machine create -d none --url="tcp://0.0.0.0:2375" default

$ docker-machine env default

Error checking TLS connection: Error checking and/or regenerating the certs: There was an error validating certificates for host "0.0.0.0:2375": dial tcp 0.0.0.0:2375: getsockopt: connection refused
You can attempt to regenerate them using 'docker-machine regenerate-certs [name]'.
Be advised that this will trigger a Docker daemon restart which will stop running containers.


$ docker-machine ls

NAME      ACTIVE   DRIVER   STATE     URL                  SWARM   DOCKER    ERRORS
default   -        none     Running   tcp://0.0.0.0:2375           Unknown   Unable to query docker version: Cannot connect to the docker engine endpoint

问题出在哪里了?

大家讲道理大家讲道理2895 days ago238

reply all(0)I'll reply

No reply
  • Cancelreply