🚀 DevOps & SRE Certification Program 📅 Starting: 1st of Every Month 🤝 +91 8409492687 🔍 Contact@DevOpsSchool.com

Upgrade & Secure Your Future with DevOps, SRE, DevSecOps, MLOps!

We spend hours on Instagram and YouTube and waste money on coffee and fast food, but won’t spend 30 minutes a day learning skills to boost our careers.
Master in DevOps, SRE, DevSecOps & MLOps!

Learn from Guru Rajesh Kumar and double your salary in just one year.


Get Started Now!

Docker Compose Tutorials: Collection & Example of Docker Compose Program

version: '2'
services:
wordpress:
image: wordpress:latest # https://hub.docker.com/_/wordpress/
ports:
- 127.0.0.1:80:80 # change ip if required
volumes:
- ./wp-app:/var/www/html # Full wordpress project
#- ./plugin-name/trunk/:/var/www/html/wp-content/plugins/plugin-name # Plugin development
#- ./theme-name/trunk/:/var/www/html/wp-content/themes/theme-name # Theme development
environment:
WORDPRESS_DB_HOST: db
WORDPRESS_DB_NAME: wordpress
WORDPRESS_DB_USER: root
WORDPRESS_DB_PASSWORD: password
depends_on:
- db
networks:
- wordpress-network
db:
image: mysql:latest # https://hub.docker.com/_/mysql/ - or mariadb https://hub.docker.com/_/mariadb
ports:
- 127.0.0.1:3306:3306 # change ip if required
volumes:
- ./wp-data:/docker-entrypoint-initdb.d
environment:
MYSQL_DATABASE: wordpress
MYSQL_ROOT_PASSWORD: password
networks:
- wordpress-network
networks:
wordpress-network:
driver: bridge
version: '2'
services:
wordpress:
image: wordpress:4.5
depends_on:
- db
links:
- db
ports:
- "8080:80"
environment:
WORDPRESS_DB_HOST: db:3306
WORDPRESS_DB_USER: wordpress
WORDPRESS_DB_PASSWORD: wordpress
restart: always
db:
image: mariadb:10.1
volumes:
- "./volumes/db:/var/lib/mysql"
restart: always
environment:
MYSQL_ROOT_PASSWORD: example
MYSQL_DATABASE: wordpress
MYSQL_USER: wordpress
MYSQL_PASSWORD: wordpress
version: '2'
services:
a:
image: tutum/hello-world
b:
image: tutum/hello-world
networks:
default:
driver: bridge
version: '2'
services:
worker:
image: tutum/hello-world
volumes:
- results:/results
reporting:
image: tutum/hello-world
volumes_from:
- worker:ro
volumes:
results:
version: '2'
services:
a:
image: tutum/hello-world
b:
image: tutum/hello-world
networks:
default:
driver: bridge
version: '2'
services:
worker:
image: tutum/hello-world
volumes:
- results:/results
reporting:
image: tutum/hello-world
volumes_from:
- worker:ro
volumes:
results:
version: '2'
services:
a:
image: tutum/hello-world
b:
image: tutum/hello-world
networks:
default:
driver: bridge
version: '2'
services:
a:
image: tutum/hello-world
networks:
- frontend
b:
image: tutum/hello-world
networks:
- frontend
- backend
c:
image: tutum/hello-world
networks:
- backend
networks:
frontend:
driver: bridge
backend:
driver: bridge
version: '2'
services:
a:
image: tutum/hello-world
networks:
- frontend
b:
image: tutum/hello-world
networks:
frontend:
aliases:
- web
backend:
aliases:
- website
c:
image: tutum/hello-world
networks:
- backend
networks:
frontend:
driver: bridge
backend:
driver: bridge
version: '2'
services:
a:
image: tutum/hello-world
container_name: eh
networks:
frontend:
aliases:
- web
b:
image: tutum/hello-world
networks:
frontend:
aliases:
- web
backend:
aliases:
- website
c:
image: tutum/hello-world
networks:
- backend
networks:
frontend:
driver: bridge
backend:
driver: bridge
version: '2'
services:
a:
image: tutum/hello-world
networks:
frontend:
aliases:
- web
b:
image: tutum/hello-world
networks:
frontend:
aliases:
- web
backend:
aliases:
- website
c:
image: tutum/hello-world
networks:
- backend
networks:
frontend:
driver: bridge
backend:
driver: bridge
web:
image: wordpress
links:
- mysql
environment:
- WORDPRESS_DB_PASSWORD=sample
ports:
- "8080:80"
mysql:
image: mysql:5.5
environment:
- MYSQL_ROOT_PASSWORD=sample
- MYSQL_DATABASE=wordpress
version: '2'
services:
a:
image: tutum/hello-world
links:
- b:bee
- c:see
networks:
- frontend
b:
image: tutum/hello-world
networks:
- frontend
- backend
c:
image: tutum/hello-world
networks:
- backend
networks:
frontend:
driver: bridge
backend:
driver: bridge
version: '2'
services:
a:
image: tutum/hello-world
external_links:
- hello:h
networks:
- frontend
- superbridge
b:
image: tutum/hello-world
networks:
- frontend
- backend
c:
image: tutum/hello-world
networks:
- backend
networks:
frontend:
driver: bridge
backend:
driver: bridge
superbridge:
external: true
version: '2'
services:
nginx:
image: nginx
volumes:
- ./conf.d:/etc/nginx/conf.d:ro
ports:
- 80
# default.conf
server {
listen 80;
server_name localhost;
location / {
return 200 "Hello, World!";
}
}
version: '2'
services:
worker:
image: tutum/hello-world
volumes:
- results:/results
reporting:
image: tutum/hello-world
volumes_from:
- worker:ro
volumes:
results:
version: '2'
services:
resizer:
image: tutum/hello-world
volumes:
- images:/images:rw
volumes:
images:
external: true
version: '2'
services:
wordpress:
image: wordpress:4.5
links:
- db
ports:
- 8080:80
environment:
WORDPRESS_DB_HOST: db:3306
WORDPRESS_DB_PASSWORD: example
restart: always
db:
image: mariadb
environment:
MYSQL_ROOT_PASSWORD: example
version: '2'
services:
wordpress:
image: wordpress:4.5
depends_on:
- db
links:
- db
ports:
- "8080:80"
environment:
WORDPRESS_DB_HOST: db:3306
WORDPRESS_DB_USER: wordpress
WORDPRESS_DB_PASSWORD: wordpress
restart: always
db:
image: mariadb:10.1
volumes:
- "./volumes/db:/var/lib/mysql"
restart: always
environment:
MYSQL_ROOT_PASSWORD: example
MYSQL_DATABASE: wordpress
MYSQL_USER: wordpress
MYSQL_PASSWORD: wordpress
version: '2'
services:
wordpress:
image: wordpress:4.5
depends_on:
- db
links:
- db
ports:
- "8080:80"
environment:
WORDPRESS_DB_HOST: db:3306
WORDPRESS_DB_USER: wordpress
WORDPRESS_DB_PASSWORD: wordpress
restart: always
db:
image: mariadb:10.1
volumes:
- "./volumes/db:/var/lib/mysql"
restart: always
environment:
MYSQL_ROOT_PASSWORD: example
MYSQL_DATABASE: wordpress
MYSQL_USER: wordpress
MYSQL_PASSWORD: wordpress
## makefile
.PHONY: up down start stop cleanContainers clean
up:
docker-compose up $(opts)
down:
docker-compose down $(opts)
start:
docker-compose up -d $(opts)
cleanContainers:
docker-compose rm --force --all
cleanVolumes:
rm -rf volumes
clean: cleanContainers cleanVolumes
version: '2'
services:
hello-world:
image: tutum/hello-world
ports:
- 8080:80
version: '2'
services:
wordpress:
image: wordpress:4.5
links:
- db
ports:
- 8080:80
environment:
WORDPRESS_DB_HOST: db:3306
WORDPRESS_DB_PASSWORD: example
restart: always
db:
image: mariadb
environment:
MYSQL_ROOT_PASSWORD: example
version: '2'
services:
wordpress:
image: wordpress:4.5
depends_on:
- db
links:
- db
ports:
- "8080:80"
environment:
WORDPRESS_DB_HOST: db:3306
WORDPRESS_DB_USER: wordpress
WORDPRESS_DB_PASSWORD: wordpress
restart: always
db:
image: mariadb:10.1
volumes:
- "./volumes/db:/var/lib/mysql"
restart: always
environment:
MYSQL_ROOT_PASSWORD: example
MYSQL_DATABASE: wordpress
MYSQL_USER: wordpress
MYSQL_PASSWORD: wordpress
version: '2'
services:
a:
image: tutum/hello-world
b:
image: tutum/hello-world
networks:
default:
driver: bridge
version: '2'
services:
worker:
image: tutum/hello-world
volumes:
- results:/results
reporting:
image: tutum/hello-world
volumes_from:
- worker:ro
volumes:
results:
version: '2'
services:
hello-world:
image: tutum/hello-world
ports:
- 8080:80
version: '2'
services:
wordpress:
image: wordpress:4.5
links:
- db
ports:
- 8080:80
environment:
WORDPRESS_DB_HOST: db:3306
WORDPRESS_DB_PASSWORD: example
restart: always
db:
image: mariadb
environment:
MYSQL_ROOT_PASSWORD: example
Subscribe
Notify of
guest


0 Comments
Newest
Oldest Most Voted
Inline Feedbacks
View all comments

Certification Courses

DevOpsSchool has introduced a series of professional certification courses designed to enhance your skills and expertise in cutting-edge technologies and methodologies. Whether you are aiming to excel in development, security, or operations, these certifications provide a comprehensive learning experience. Explore the following programs:

DevOps Certification, SRE Certification, and DevSecOps Certification by DevOpsSchool

Explore our DevOps Certification, SRE Certification, and DevSecOps Certification programs at DevOpsSchool. Gain the expertise needed to excel in your career with hands-on training and globally recognized certifications.

0
Would love your thoughts, please comment.x
()
x