I'm on mac (Apple chip), and I'm trying to create a Symfony project using Symfony CLI & Docker.
$ symfony create new_project
$ cd new_project
$ symfony composer require orm
It install Symfony, Doctrine, and ask me to create docker-compose.yml
.
Perfect.
I can even launch docker-compose up --build
and I can see the container being build & launched on my Docker Desktop application.
But when I launch my symfony server, I'm unable to connect to the database.
As I read, I try the command symfony var:export -vv
and then, I can see than none of the docker variables are automatically exported. And I can see, thanks to the -vv
option, this silent error :
WARNING symfony Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?
I looked at this error and I try docker-machine ls
. I can see that there is no docker-machine working on my computer, even if my Docker Desktop says otherwhise.
How can I make Docker Desktop & Symfony CLI works together ? Why docker-image
and Docker Desktop doesn't communicate ?
When I look to the Docker Desktop documentation, they mention that the Docker Desktop provide the docker API through unix:///var/run/docker.sock
but mine seams not working.
Thank you for your help :)
CodePudding user response:
docker-machine
is a legacy software for OSX. Uninstall it and install the latest version of docker using the command brew install --cask docker
and then try the same steps as before.