파일을 작성한다.
version: '3'
services:
class-offering:
image: php:7.2-apache
volumes:
- ./classes:/var/www/html
ports:
- 5001:80
website:
image: php:7.2-apache
volumes:
- ./website:/var/www/html
ports:
- 5000:80
depends_on:
- class-offering
//ubuntu docker compose install
$sudo docker rm -f $(sudo docker ps -a -q) //모든 docker container 제거
$sudo curl -L "https://github.com/docker/compose/releases/download/1.29.0/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
$sudo chmod +x /usr/bin/docker-compose
$sudo docker-compose up -d
docker-compose install
sudo docker-compose up -d
<html>
<head>
<title>Class Offered in 2020</title>
</head>
<body>
<h1>These are classes offered by easttwave</h1>
<ul>
<?php
$json = file_get_contents('http://class-offering');
$obj = json_decode($json);
foreach ($obj as $class) {
echo "<li>$class</li>";
}
?>
</ul>
</body>
</html>
<?php
$myclasses[] = 'Software Engineering';
$myclasses[] = 'Digital logic';
$myclasses[] = 'Internet programming';
$myclasses[] = 'Network Programming';
$myJson = json_encode($myclasses);
echo $myJson;
?>
version: '3.3'
services:
db:
image: mysql:5.7
volumes:
- db_data:/var/lib/mysql
restart: always
environment:
MYSQL_ROOT_PASSWORD: somewordpress
MYSQL_DATABASE: wordpress
MYSQL_USER: wordpress
MYSQL_PASSWORD: wordpress
wordpress:
depends_on:
- db
image: wordpress:latest
ports:
- "8000:80"
restart: always
environment:
WORDPRESS_DB_HOST: db:3306
WORDPRESS_DB_USER: wordpress
WORDPRESS_DB_PASSWORD: wordpress
WORDPRESS_DB_NAME: wordpress
volumes:
db_data: {}
$ sudo curl -L "https://github.com/docker/compose/releases/download/1.29.0/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
$ sudo mv /usr/local/bin/docker-compose /usr/bin/docker-compose
$ sudo chmod +x /usr/bin/docker-compose
$ sudo docker-compose up -d