Comments (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.
thanks
from kubephp.
Related Issues (16)
- Not an issue, I use this to host README.md images. 🖼 😅 HOT 8
- How to use with Laravel? HOT 3
- Issue with installing extensions HOT 6
- Use simple php app HOT 1
- nginx: [emerg] no "events" section in configuration HOT 3
- How to share and keep synced code inside /app/public between php fpm and nginx container in k8s ? HOT 1
- APP_BASE_DIR
- Why is pre-prod script trying to create a file on a readonly filesystem HOT 2
- Can't copy dev scripts from docker HOT 4
- Stuck on "► Running Composer Install..." HOT 4
- Production php ini not copied to conf folder HOT 1
- Mounting volumes and permissions HOT 3
- Possible to run something after `php-fpm` has started? HOT 4
- chown www-data var dir error HOT 2
- php:*-fpm-alpine as base image
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from kubephp.