Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # use version 3 of the docker compose syntax
- version: '3'
- services:
- # we named our first service 'web'
- web:
- # pass a hostname to the container (optinal)
- hostname: hostname.local
- # build a custom image
- build:
- context: .
- dockerfile: .docker/web.dockerfile
- # a name for easier reference
- image: hostname.local
- # map host port 8080 to container port 80
- ports:
- - 8080:80
- # volumes are like shared folders
- # container will see your local code changes
- volumes:
- - .:/app
- # first load the 'db' service
- depends_on:
- - db
- # make 'db' a known service/host inside of 'web'
- # use this to make a mysql connection to host 'db'
- links:
- - db
- db:
- # use a default image
- image: mysql:5.7
- # again, port mapping
- # e.g. to use Sequel Pro on our mac
- ports:
- - 13306:3306
- # the mysql image uses these to create database and users
- environment:
- MYSQL_ROOT_PASSWORD: something-secure-here
- MYSQL_DATABASE: db
- MYSQL_USER: user
- MYSQL_PASSWORD: something-secure-here
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement