-
Notifications
You must be signed in to change notification settings - Fork 0
/
v28.dockerCommand.txt
57 lines (28 loc) · 1.08 KB
/
v28.dockerCommand.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
docker create -it -d --name container dockerimage --- create but not up and running
docker start <id>
docker stop <id>
docker rm -f <id>
docker run-it --name container --hostname demo dockerimage
ip a
apt install iproute2
docker exec -it id bash
docker run --rm -it --name ubuntucon ubuntu
curl <ipaddress>
port forwarding
docker run -d -it --name nginixcon -p 8090:80 ubuntu
change inbound rule -> security group to allow the port
curl <ip>
---------------------------------------------------------------
mysql
----
docker run -d -it --name mysqlcon --hostname mysql -e MYSQL_ROOT_PASSWORD=test123 -e MYSQL_ROOT_HOST='%' mysql ->
-> container ip = 172.17.0.4 <ipaddress>
mysql
apt install mysql-client-core-8.0
docker inspect <conid>
mysql -h <ipaddress> -u root -ptest123
show databases;
------------------------------------------------------------------------
wordpress container:
-------------------
docker run -d -it --name wordpress -e WORDPRESS_DB_HOST=172.17.0.4 -e WORDPRESS_DB_USER=root -e WORDPRESS_DB_PASSWORD=test123 -e WORDPRESS_DB_NAME=devops -p 9090:80 wordpress