常用数据库 Docker 命令
MySQL
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
| docker search mysql
docker pull mysql:latest
docker images
docker run -itd -p 3306:3306 -e MYSQL_ROOT_PASSWORD=123456 --name mysql mysql
docker run -itd -p 3306:3306 -v /Users/duanzhengqiang/softs/mysql/my.cnf:/etc/mysql/my.cnf -e MYSQL_ROOT_PASSWORD=123456 --name mysql_8.0 mysql:8.0
docker ps
docker exec -it mysql /bin/bash
docker exec -it mysql mysql -u sharding -h host.docker.internal -P 3307 -p
|
解决 MySQL 中文乱码的 my.cnf
参考配置:
1 2 3 4 5 6 7 8 9 10 11 12 13
| [client] default-character-set=utf8mb4 [mysql] default-character-set=utf8mb4 [mysqld] port=3306
character-set-server=utf8mb4 character-set-filesystem=utf8mb4 collation-server=utf8mb4_general_ci init-connect='SET NAMES utf8mb4'
lower-case-table-names=1
|
PostgreSQL
1 2 3 4 5 6 7 8
| docker search postgres
docker pull postgres
docker run -d -p 5432:5432 -e POSTGRES_PASSWORD=123456 --name postgres postgres
docker exec -it postgres psql -U sharding -d sharding_db -h host.docker.internal -p 3307
|
openGauss
1 2 3 4 5 6 7 8 9
|
docker search opengauss
docker pull enmotech/opengauss
docker run --privileged=true -d -e GS_PASSWORD=Sphere@123 -p 5432:5432 --name opengauss enmotech/opengauss
docker run --rm -it enmotech/opengauss gsql -U sharding -d sharding_db -W'sharding' -h host.docker.internal -p 3307
|
Oracle
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
| docker search oracle-19c
docker pull doctorkirk/oracle-19c
mkdir -p /Users/strongduanmu/softs/oracle/oracle_19c_data
chmod 777 /Users/strongduanmu/softs/oracle/oracle_19c_data
docker run -d \ -p 1521:1521 -p 5500:5500 \ -e ORACLE_SID=ORCLSID \ -e ORACLE_PDB=ORCLPDB \ -e ORACLE_PWD=123456 \ -e ORACLE_EDITION=standard \ -e ORACLE_CHARACTERSET=AL32UTF8 \ -v /Users/strongduanmu/softs/oracle/oracle_19c_data \ --name oracle_19c doctorkirk/oracle-19c
docker logs -ft oracle_19c
docker exec -it oracle_19c /bin/bash sqlplus / as sysdba show pdbs;
|
StarRocks
1 2 3 4 5 6
| docker pull starrocks/allin1-ubuntu:2.5.8
docker run --name starrocks -p 9030:9030 -p 8030:8030 -p 8040:8040 -itd starrocks/allin1-ubuntu:2.5.8
mysql -P9030 -h127.0.0.1 -uroot --prompt="StarRocks > "
|
Zookeeper
1 2 3
| docker pull zookeeper
docker run -d --name zookeeper --privileged=true -p 2181:2181 zookeeper
|
Jenkins
1 2 3 4 5 6 7 8 9
| docker pull jenkinsci/blueocean
docker run --name jenkins -u root -d -p 8080:8080 -p 50000:50000 -v /Users/duanzhengqiang/.m2:/root/.m2 -v /var/run/docker.sock:/var/run/docker.sock jenkinsci/blueocean
localhost:8080
docker logs jenkins
|
ShardingSphere
1 2 3 4 5 6 7 8
| brew install socat socat TCP-LISTEN:2375,reuseaddr,fork UNIX-CLIENT:/var/run/docker.sock
export DOCKER_HOST=tcp://127.0.0.1:2375
./mvnw -B clean install -am -pl test/e2e/sql -Pit.env.docker -DskipTests -Dspotless.apply.skip=true -T 1C
|