docker修练之windows与linux下实践记录
mysql 持久化
mkdir -p /var/own/mysqldata/ docker run --name mmsql -v /var/own/mysqldata/mysql/:/var/lib/mysql -d --restart=always -p 3306:3306 -e MYSQL_ROOT_PASSWORD=12345 hub.c.163.com/library/mysql
docker run --name mysql -v /data/mysql:/var/lib/mysql -d --restart=always -p 3306:3306 -e MYSQL_ROOT_PASSWORD=123456 -e MYSQL_USER=root -e MYSQL_PASSWORD=root mysql:5.7
Redis
mkdir - p /var/own/redis/
docker run -p 6379:6379 -v /var/own/redis/data:/data -d --restart=always hub.c.163.com/library/redis redis-server --appendonly yes
目录自建 E:\data-redis\data
docker run --name myredis -p 6379:6379 -v E:\data-redis\data:/data -d hub.c.163.com/library/redis redis-server --appendonly yes
linux 下redis操作
docker exec -it myredis redis-cli
windows 下redis操作
winpty docker exec -it myredis redis-cli
ElasticSearch (改版 配置变了 这个目前需要log配置)
vim /var/own/ES/config/log4j2.properties
status = error appender.console.type = Console appender.console.name = console appender.console.layout.type = PatternLayout appender.console.layout.pattern = [%d{ISO8601}][%-5p][%-25c{1.}] %marker%m%n rootLogger.level = info rootLogger.appenderRef.console.ref = console #csrf http.cors.enabled: true http.cors.allow-origin: "*"
mkdir -p /var/own/ES/{config,data}
docker run -d --name es -v "/var/own/ES/config":/usr/share/elasticsearch/config -v "/var/own/ES/data":/usr/share/elasticsearch/data hub.c.163.com/library/elasticsearch
RabbitMQ (3.6.11-management 是带ui界面的版本)
docker run -d --hostname my-rabbit --name myrabbitmq -p 5672:5672 -p 15672:15672 -p 25672:25672 hub.c.163.com/library/rabbitmq:3.6.11-management
registry镜像仓库
mkdir $DATA_DIR sudo docker run -d -p 5000:5000 -v $DATA_DIR/data:/var/lib/registry --restart=always --name registry registry:2
Rancher容器服务管理平台 (炒鸡好用)
windows 自建目录 D:\docker-rancher 对外访问端口 5001 如下 自改
docker run -d -v D:\docker-rancher:/var/lib/mysql --restart=unless-stopped -p 5001:8080 rancher/server
mkdir - p /usr/local/src/data/rancherdata
docker run -d -v /usr/local/src/data/rancherdata:/var/lib/mysql --restart=unless-stopped -p 5001:8080 rancher/server
Jenkins
docker run -p 8080:8080 -p 50000:50000 -v /opt/kenkins-data:/var/jenkins_home jenkins
Arangodb
创建本地卷 之后
docker run --name arangodb -v /data/arangodb:/var/lib/arangodb3 -e ARANGO_NO_AUTH=1 -p 8529:8529 -d --restart=always 172.30.253.174/db/arangodb/arangodb:3.4.0 arangod \ --server.endpoint tcp://0.0.0.0:8529\
创建用户
db._createDatabase('dbname');
db._useDatabase('_system');
require('@arangodb/users').save('username','password');
db._useDatabase('_system');
require('@arangodb/users').grantDatabase('username', 'dbname', 'rw');
数据同步
cd /usr/bin
arangorestore --server.endpoint tcp://172.30.253.133:8529 --server.username root --server.password 123456 --server.database cmdb --input-directory /var/lib/arangodb3/release-1.0.7 --overwrite true
nhz94259@163.com