August 12, 2017

The Docker Compose File

We quickly go over the docker-compose.yml file used to run our application in Docker.

We cover what our docker-compose.yml file is doing when we start or stop our services.

version: '2'
services:
  nginx:
    image: shippingdocker/nginx:latest
    ports:
     - "80:80"
    volumes:
     - ./application:/var/www/html
    networks:
     - appnet
  php:
    image: shippingdocker/php:latest
    volumes:
     - ./application:/var/www/html
    networks:
     - appnet
  redis:
    image: redis:alpine
    networks:
     - appnet
  db:
    image: mysql:5.7
    environment:
      MYSQL_ROOT_PASSWORD: secret
      MYSQL_DATABASE: homestead
      MYSQL_USER: homestead
      MYSQL_PASSWORD: secret
    volumes:
     - data:/var/lib/mysql
    networks:
     - appnet
networks:
  appnet:
    driver: "bridge"
volumes:
  data:
    driver: "local"

Looking for a deeper dive into Docker?

Sign up here to get a preview of the Shipping Docker course! Learn how to integrate Docker into your applications and develop a workflow to make using Docker a breeze!

All Topics