Advertisement
Guest User

Untitled

a guest
Jun 19th, 2018
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
YAML 1.15 KB | None | 0 0
  1. # use version 3 of the docker compose syntax
  2. version: '3'
  3. services:
  4.  # we named our first service 'web'
  5.   web:
  6.    # pass a hostname to the container (optinal)
  7.     hostname: hostname.local
  8.    
  9.     # build a custom image
  10.     build:
  11.       context: .
  12.       dockerfile: .docker/web.dockerfile
  13.    
  14.     # a name for easier reference
  15.     image: hostname.local
  16.  
  17.     # map host port 8080 to container port 80
  18.     ports:
  19.        - 8080:80
  20.    
  21.     # volumes are like shared folders
  22.     # container will see your local code changes
  23.     volumes:
  24.      - .:/app
  25.    
  26.     # first load the 'db' service
  27.     depends_on:
  28.      - db
  29.    
  30.     # make 'db' a known service/host inside of 'web'
  31.     # use this to make a mysql connection to host 'db'
  32.     links:
  33.      - db
  34.  
  35.   db:
  36.    # use a default image
  37.     image: mysql:5.7
  38.  
  39.     # again, port mapping
  40.     # e.g. to use Sequel Pro on our mac
  41.     ports:
  42.      - 13306:3306
  43.  
  44.     # the mysql image uses these to create database and users
  45.     environment:
  46.       MYSQL_ROOT_PASSWORD: something-secure-here
  47.       MYSQL_DATABASE: db
  48.       MYSQL_USER: user
  49.       MYSQL_PASSWORD: something-secure-here
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement