-
Notifications
You must be signed in to change notification settings - Fork 858
/
1.2 DockerStackCommands.txt
51 lines (46 loc) · 1.24 KB
/
1.2 DockerStackCommands.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
sudo curl -L "https://github.com/docker/compose/releases/download/1.23.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
chmod +x /usr/local/bin/docker-compose
docker-compose --version
#docker-compose.yml
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: {}
docker-compose up -d
docker container ls
docker-compose scale db=3
docker container ls
docker-compose down
docker container ls
cp docker-compose.yml stack.yml
docker stack --help
docker stack deploy -c stack.yml mystack
docker stack ls
docker stack services mystack
docker service ps mystack_db
docker service ps mystack_wordpress
docker network ls
docker stack ls
docker stack rm mystack