Giter VIP home page Giter VIP logo

Comments (2)

hacfi avatar hacfi commented on May 18, 2024 2

As you copy the docker-compose.yml to your project you can add your database of choice there. For mysql e.g.:

version: '3.4'

services:
  # ...

  db:
    image: mysql:5.7 # or percona or mariadb
    ports:
      - "3306:3306"
    volumes:
      - mysql_data:/var/lib/mysql:rw
    environment:
      MYSQL_DATABASE: "db"
      MYSQL_USER: "user"
      MYSQL_PASSWORD: "password"
      MYSQL_ALLOW_EMPTY_PASSWORD: "yes"

volumes:
  mysql_data:
    driver: local

and add DATABASE_URL: "mysql://user:password@db:3306/db" to your env vars (see https://github.com/sherifabdlnaby/symdocker/blob/master/docker/.compose/docker-compose.yml#L14).

For postgres you can use something like:

version: '3.4'

services:
  # ...

  db:
    image: postgres:12
    ports:
      - "5432:5432"
    volumes:
      - pgdata:/var/lib/postgresql/data:rw
    environment:
      POSTGRES_USER: "user"
      POSTGRES_PASSWORD: "password"
      POSTGRES_DB: "db"

volumes:
  pgdata:
    driver: local

and use "postgres://user:password@db:5432/db" as the DATABASE_URL.

from kubephp.

litan1106 avatar litan1106 commented on May 18, 2024

thanks

from kubephp.

Related Issues (16)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.