docker-php7 icon indicating copy to clipboard operation
docker-php7 copied to clipboard

How to connect to the DB?

Open paulcanning opened this issue 7 years ago • 2 comments

How exactly do I connect to the DB after the docker is running?

paulcanning avatar Feb 05 '18 10:02 paulcanning

I combined this project and opencart, but when i register account, 504 timeout nginx. How should I do ?. Thank you

hansin91 avatar Mar 12 '18 07:03 hansin91

Add ports to the db service:

version: "2"
services:
  nginx:
      build:
          context: ./nginx
      ports:
          - "8080:80"
      volumes:
          - ./app:/var/app
  fpm:
      build:
          context: ./fpm
      volumes:
          - ./app:/var/app
      expose:
          - "9000"
      environment:
          - "DB_HOST=db"
          - "DB_DATABASE=laravel"
  db:
      image: mariadb:10.4.12
      ports:
          - "3306:3306"
      environment:
          - MYSQL_ROOT_PASSWORD=root
          - MYSQL_DATABASE=laravel
      volumes:
          - ./database:/var/lib/mysql

Then you can connect using: mysql -u root -p

andreshg112 avatar Dec 14 '20 15:12 andreshg112