I am newby into docker but until now could run “php artisan migrate” from host powershell and it worked, but I had to format, and right now is impossible run that command out of container.
Now when run “php artisan migrate” recive this message:
In Connection.php line 647:
could not find driver (SQL: select * from information_schema.tables where table_schema = webmotor_db and table_name = migrations)
As you guest my OS is Windows 10 Pro (build 17074 insider)
I use docker-compose.yml and it works fine
I would like fix that because my mind is going out with this stupid case.
I don`t understand, usually in the .env file define “DB_HOST = localhost” or 127.0.0.1 but I have been trying others ways.
dbdata is in volumes so:
volumes:
dbdata:
If you are so gentil could you explain how define every parameter, please
for this discussion think of containers a machines on a network… completely separated from each other.
each machine mus have a name, that name is how you find the other machine on the network…
your connection string says ‘dbdata’, but that is NOT the name of the DB ‘machine’. it is a volume.
"DB_HOST=dbdata"
there was no NAME provided for the database ‘machine’ in the docker compose file.
or this
PMA_HOST: mysql
there was
database:
image: mysql:5.7
unless you specify otherwise, then NAME of the ‘machine’ matches the NAME of the docker compose ‘service’… in this case ‘database’
draw it out on a piece of paper or whiteboard…
three machines…
web
database
phpmyadmin
they each will have their own unique IP address…
so for phpmyadmin to connect to the mysql db on machine database the host name needs to be
PMA_HOST: database
looks like app container is now correct
DB_HOST=database
docker compose hides all the details…
after the containers are running ;look at their config with the docker inspect command
the ping not answer nothing, loss all packets…
But I wonder how the “php artisan migrate” it was woriking before…without needless to enter into container…