-
Notifications
You must be signed in to change notification settings - Fork 0
/
docker.txt
27 lines (18 loc) · 964 Bytes
/
docker.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
### Running a docker mysql instance ###
# docker-machine ip default 192.168.1.110
# docker ps -a
# docker images
# docker pull mysql
# docker rmi mysql
# docker stop spring-mysql
# docker start spring-mysql
# docker rm -f spring-mysql
# docker run --name spring-mysql -e MYSQL_ROOT_PASSWORD=admin -e MYSQL_DATABASE=springlesson -e MYSQL_USER=springlesson -e MYSQL_PASSWORD=springlesson -p 3306:3306 -d mysql:5.6
# run client
# docker run -it --link spring-mysql:mysql --rm mysql sh -c 'exec mysql -h"$MYSQL_PORT_3306_TCP_ADDR" -P"$MYSQL_PORT_3306_TCP_PORT" -uroot -p"$MYSQL_ENV_MYSQL_ROOT_PASSWORD"'
# docker logs demo-mysql
# SELECT User FROM mysql.user;
# CREATE USER 'springlesson'@'localhost' IDENTIFIED BY 'springlesson';
# SHOW GRANTS FOR 'springlesson'@'localhost';
# docker pull postgres
# docker run --name spring-postgres -e POSTGRES_PASSWORD=springlesson -e POSTGRES_USER=springlesson -e POSTGRES_DB=springlesson -p 5432:5432 -d postgres:9.6.1