Setting up a new Laravel install using docker, this is the docker-compose.yml file:
version: '2'
services:
web:
image: nginx
restart: always
links:
- "fpm"
volumes:
- ./build/volumes/nginx/conf.d:/etc/nginx/conf.d:ro
volumes_from:
- fpm
ports:
- 8080:80
mysql:
image: mysql
environment:
MYSQL_ROOT_PASSWORD: "[OMMITTED]"
MYSQL_DATABASE: "[OMMITTED]"
MYSQL_USER: "[OMMITTED]"
MYSQL_PASSWORD: "[OMMITTED]"
fpm:
build:
context: .
volumes:
- .:/var/www
docker-compose up -d works fine and I can see the web sever at http://localhost:8080/ , however when trying to do any type of connection to the database, I get a PDO::__construct(): php_network_getaddresses: getaddrinfo failed: nodename nor servname provided, or not known error message.
My .env file contains the following ( the DB_HOST is the container name ):
DB_CONNECTION=mysql
DB_HOST=container_mysql_1
DB_PORT=3306
DB_DATABASE=[OMMITTED]
DB_USERNAME=[OMMITTED]
DB_PASSWORD=[OMMITTED]
Attempted to use localhost as the DB_HOST however, it comes back with the Access denied for user error and i've checked that the details are correct. I'm assuming the docker containers are not talking to each other?
from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2hw4j8X
via IFTTT
Aucun commentaire:
Enregistrer un commentaire