Introduction to Docker Compose

source: docker
  • Define your app’s environment with a Dockerfile so it can be reproduced anywhere.
  • Define the services that make up your app in docker-compose.yml so they can be run together in an isolated environment.
  • Run docker-compose up and Compose starts and runs your entire app. source : https://docs.docker.com/compose/
sudo curl -L https://github.com/docker/compose/releases/download/1.20.1/docker-compose-$(uname -s)-$(uname -m) -o /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose
sudo docker-compose — version
mkdir /lab/my_wordpress
cd /lab/my_wordpress
version: '3.2'services:
db:
image: mysql:5.7
volumes:
- dbdata:/var/lib/mysql
restart: always
environment:
MYSQL_ROOT_PASSWORD: somewordpress
MYSQL_DATABASE: wordpress
MYSQL_USER: [username]
MYSQL_PASSWORD: [password]
wordpress:
depends_on:
- db
image: wordpress:latest
ports:
- "8000:80"
restart: always
environment:
WORDPRESS_DB_HOST: db:3306
WORDPRESS_DB_USER: [username]
WORDPRESS_DB_PASSWORD: [password]
volumes:
dbdata:
sudo docker-compose up -d
sudo docker container ls
Access wordpress on web browser

--

--

--

This is my little notes based my experiment and my learning. Keep learning and keep calm.

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Learn SCSS (Sass) Part 2

My encounter with git!

In this Task, First we will know about EC2 instance and then We will Launch an EC2 instance in AWS…

Deploy WSO2 Stream Processor profiles using Ansible scripts

Ansible Task-1

Understanding Dev Speak 101

FUNDAMENTALS OF KUBERNETES

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Hakim

Hakim

This is my little notes based my experiment and my learning. Keep learning and keep calm.

More from Medium

Application Frameworks Blog(Week 1,2)

git hub versioning:

Prevent real Admob ad id while development

env: node\r: No such file or directory