forked from pradeepch82/docker-repository
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdocker-advanced.txt
96 lines (61 loc) · 1.89 KB
/
docker-advanced.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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
Docker Network commands
=========================
docker network ls
docker network create networkName
docker network rm networkName
docker network inspect networkName
docker run --name containerName -d -it --net networkName imageName options
docker network connect networkName containerName
docker attach containerName
docker exec -it containerName options
docker network disconnect networkName containerName
docker network prune
day1
====
Containers in default bridge Network
=====================================
docker network ls
NETWORK ID NAME DRIVER SCOPE
33d14a88f43f bridge bridge local
45d14a88f43f host host local
46d14a88f43f none none local
docker run --name centos-1 -it centos bash
docker run --name centos-2 -it centos bash
docker ls
docker inspect bridge
Containers in custom bridge Network
=====================================
docker network create myNetwork
docker run --name centos-1 -net myNetwork -it centos bash
docker run --name centos-2 -net myNetwork -it centos bash
day2
=====
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