常用的镜像命令
docker run -d --name dockerui -p 9000:9000 -v /var/run/docker.sock:/var/run/docker.sock abh1nav/dockerui
docker run -d --name nexus2 -p 8081:8081 sonatype/nexus:oss
docker run -d --name mysql57 -p 3306:3306 -e MYSQL_ROOT_PASSWORD=root mysql:5.7.26
docker run -d --name shadow##socks -p 54321:8388 -p 54321:8388/udp -e PASSWORD=****** -e METHOD=rc4-md5 shadow##socks/shadow##socks-libev
docker run -d --name nginx -p 80:80 -v /root/nginx/conf:/etc/nginx/conf.d -v /root/nginx/html:/usr/share/nginx/html nginx
docker run -d --name rabbitmq -p 5672:5672 -p 15672:15672 rabbitmq:3-management
docker run -d --name xxl-job-admin -p 8083:8080 -e PARAMS="--spring.datasource.url=jdbc:mysql://mysql.hepengju.cn:3306/xxl_job?Unicode=true&characterEncoding=UTF-8 --spring.datasource.username=root --spring.datasource.password=rootABCDEF" xuxueli/xxl-job-admin:2.1.0
常用的数据库镜像
docker pull mysql:5.7.26
docker pull postgres:9.6.13
docker pull gcusnieux/oracle11g
docker pull store/oracle/database-enterprise:12.2.0.1
docker pull ibmcom/db2
docker pull exoplatform/sqlserver
docker pull pivotaldata/greenplum-server-ubuntu-18
常用的数据库镜像命令
mysql:
# 参考: https://hub.docker.com/_/mysql
docker run -d -p 3306:3306 -e MYSQL_ROOT_PASSWORD=root mysql:5.7.26
vim ~/.my.cnf
[client]
password='root'
docker cp .my.cnf 3d4e41ebaa1c:/root/.my.cnf
docker exec -it 3d4e41ebaa1c /bin/bash
mysql -e "drop database if exists adpdb;create database adpdb default character set utf8mb4 collate utf8mb4_bin;"
mysql -e "drop database if exists oss6 ;create database oss6 default character set utf8mb4 collate utf8mb4_bin;"
mysqldump -uroot -p××× -hmysql.hepengju.com adpdb > adpdb_$(date +%Y%m%d).sql
mysqldump -uroot -p××× -hmysql.hepengju.com oss6 > oss6_$(date +%Y%m%d).sql
mysql adpdb < ~/adpdb_$(date +%Y%m%d).sql
mysql oss6 < ~/oss6_$(date +%Y%m%d).sql
oracle:
# 参考: https://hub.docker.com/r/bofm/oracle12c
# 说明: 拉取的不是这个, 但这个里面有文档供参考
docker run -d --shm-size 1GB --name oracle_database -p 1521:1521 wangpengcheng/oracle12c-enterprise:12.2.0.1-sys
docker exec -it 111ca416ec33 /bin/bash
source ~/.bashrc
sqlplus / as sysdba
alter user sys identified by sys;
show con_name ;
show pdbs;
#alter pluggable database all open;
#alter pluggable database all save state;
alter session set container=orclpdb1;
drop user dhuser cascade;
create user dhuser identified by dhuser;
grant connect, resource, create view to dhuser;
grant dba to dhuser;
grant all privileges to dhuser;
alter user dhuser quota unlimited on users;
alter user dhuser quota unlimited on dh_data;
alter user dhuser quota unlimited on dh_index;
alter user dhuser quota unlimited on dh_his;
create or replace directory EXPDP_DIR as '/home/oracle/expdp_dir';
create tablespace dh_data datafile '/u02/app/oracle/oradata/ORCLCDB/orclpdb1/dh_data.dbf' size 100M autoextend on next 10M maxsize 10240M;
create tablespace dh_index datafile '/u02/app/oracle/oradata/ORCLCDB/orclpdb1/dh_index.dbf' size 100M autoextend on next 10M maxsize 10240M;
create tablespace dh_his datafile '/u02/app/oracle/oradata/ORCLCDB/orclpdb1/dh_his.dbf' size 100M autoextend on next 10M maxsize 10240M;
# expdp dhuser/Top#123@pdb2 schemas=dhuser directory=EXPDP_DIR dumpfile=dhuser_$(date +%Y%m%d).dmp
# docker cp 0a45cc68d3af:/home/oracle/expdp_dir/dhuser_20190525.dmp ./
docker cp dhuser_20190525.dmp 111ca416ec33:/home/oracle/expdp_dir/
impdp dhuser/dhuser@orclpdb1 directory=EXPDP_DIR dumpfile=dhuser_20190525.dmp
# "DHUSER"."ASSET_EXTERNAL_TABLE" value too large for column TRANSFER_ENCRYPTION (actual: 115, maximum: 100)
# 修改列长度, 建立远程连接, 本地Truncate后再插入; 或者修改列长度, 本地Truncate后再重新导入(怎么改长度呢)
impdp dhuser/dhuser@orclpdb1 directory=EXPDP_DIR dumpfile=dhuser_20190525.dmp tables=ASSET_EXTERNAL_TABLE
# docker stop -t 120 oracle_database
# docker start oracle_database
db2:
# 参考: https://hub.docker.com/u/hepengju/content/sub-3a88b39c-ee6d-4acd-8b93-6aa163baeafc
vim .env_list
LICENSE=accept
DB2INSTANCE=db2inst1
DB2INST1_PASSWORD=db2inst1
DBNAME=testdb
BLU=false
ENABLE_ORACLE_COMPATIBILITY=false
UPDATEAVAIL=NO
TO_CREATE_SAMPLEDB=false
REPODB=false
IS_OSXFS=false
PERSISTENT_HOME=true
HADR_ENABLED=false
ETCD_ENDPOINT=
ETCD_USERNAME=
ETCD_PASSWORD=
docker run -d --name db2server --restart=always --privileged=true -p 50000:50000 -p 55000:55000 --env-file .env_list store/ibmcorp/db2_developer_c:11.1.4.4-x86_64
docker logs -f db2server
docker exec -it db2server /bin/bash
db2 create db ftzmisdb using codeset utf-8 territory CN
# db2 force application all
# db2 backup database ftzmisdb
CREATE REGULAR TABLESPACE "TS_FTZMIS_INDEX"
CREATE REGULAR TABLESPACE "TS_FTZMIS_DATA"
db2 restore db ftzmisdb from '/database/config/db2inst1' on '/database/config/db2inst1' dbpath on '/home/db2inst1'
# 报错: SQL1139N The total size of the table space is too big. SQLSTATE=54047 解决不了
docker stop -t 120 db2server
docker start db2server
sqlserver:
# 参考: https://hub.docker.com/r/exoplatform/sqlserver
docker run -d --name sqlserver -e SA_PASSWORD=He736458 -e SQLSERVER_DATABASE=appdb -e SQLSERVER_USER=hepengju -e SQLSERVER_PASSWORD=He736458 -p 1433:1433 exoplatform/sqlserver
docker logs -f sqlserver
docker stop -t 120 sqlserver
docker start sqlserver
postgres:
docker run -d --name postgres -e POSTGRES_PASSWORD=postgres -p 5432:5432 postgres:9.6.13
docker stop postgres
docker start postgres