MacOS:
容器和镜像在如下目录下,不同版本或许可能文件版本不一样
/Users/liuhao/Library/Containers/com.docker.docker/Data
可以到上面的目录中,查看文件大小, du -sh *
本机存放位置如下
/Users/liuhao/Library/Containers/com.docker.docker/Data/vms/0/data/Docker.raw
{
"builder": {
"features": {
"buildkit": true
},
"gc": {
"defaultKeepStorage": "20GB",
"enabled": true
}
},
"experimental": false,
"registry-mirrors": [
"https://phq0kn96.mirror.aliyuncs.com",
"https://registry.docker-cn.com"
]
}
docker pull portainer/portainer
docker run -d -p 9000:9000 -p 8000:8000 \
--restart=always \
-v /var/run/docker.sock:/var/run/docker.sock \
-v /Users/liuhao/docker/portainer/data:/data \
--name prtainer \
-d portainer/portainer
zookeeper
docker pull zookeeper:latest
docker run -d --name zookeeper -p 2181:2181 --restart=always \
-v /Users/liuhao/docker/zookeeper/data:/data \
-v /Users/liuhao/docker/zookeeper/conf:/conf \
-v /Users/liuhao/docker/zookeeper/logs:/datalog \
zookeeper:latest
kafka 单机版
docker pull wurstmeister/kafka
docker run -d --name kafka -p 9092:9092 -e KAFKA_BROKER_ID=0 -e
KAFKA_ZOOKEEPER_CONNECT=host.docker.internal:2181/kafka -e
KAFKA_ADVERTISED_LISTENERS=PLAINTEXT://host.docker.internal:9092 -e
KAFKA_LISTENERS=PLAINTEXT://0.0.0.0:9092 wurstmeister/kafka:latest
Kafka macOS中需要进行ip映射 「 127.0.0.1 host.docker.internal 」 在本地hosts文件中加入映射
consul 单机版
docker pull consul
docker run -d --name=consul -p 8500:8500 consul:latest
docker pull xuxueli/xxl-job-admin:2.4.0 //不支持macOS系统需要自己拉官方代码进行打包
以下是手动打包到docker 过程
1.拉代码到本地
git clone https://gitclone.com/github.com/xuxueli/xxl-job.git
2.进到项目文件夹
cd xxl-job
3.打包
mvn clean package -Dmaven.test.skip=true
4.复制xxl-job-admin的可运行jar包到xxl-job-admin目录下
cp xxl-job-admin/target/xxl-job-admin-*-SNAPSHOT.jar xxl-job-admin/
5.先进入xxl-job-admin/ 里面有DockerFile文件
cd xxl-job-admin/
6.制作镜像到我们的mac的docker上
docker build -t 自定义的镜像名:版本号 . 不要忘了有个点.
docker build -t local-xxl-job:2.4.0 .
mysql
docker run -e PARAMS="--spring.datasource.url=jdbc:mysql://host.docker.internal:3306/xxl_job?useUnicode=true&characterEncoding=UTF-8&autoReconnect=true&serverTimezone=Asia/Shanghai --spring.datasource.username=root --spring.datasource.password=root" -p 8680:8080 \
-v /Users/liuhao/docker/xxl-job/logs:/data/applogs --name local-job-admin local-xxl-job:2.4.0
docker run -e PARAMS="--jdbc:postgresql://host.docker.internal:5432/xxl_job?useUnicode=true&characterEncoding=UTF-8&autoReconnect=true&serverTimezone=Asia/Shanghai --spring.datasource.username=postgres --spring.datasource.password=root" -p 8889:8080 \
-v /Users/liuhao/docker/xxl-job-pg/logs:/data/applogs --name xxl-job-pg ittutou/xxl-job-pg:2.4.0
docker run -p 8889:8080 \
-v /Users/liuhao/docker/xxl-job-pg/logs:/data/applogs --name xxl-job-pg ittutou/xxl-job-pg:2.4.0
docker pull redis:6.2.0
docker run -p 6379:6379 --name redis \
-v /Users/liuhao/docker/redis/data:/data \
-v /Users/liuhao/docker/redis/config/redis.conf:/etc/redis/redis.conf \
-d redis:6.2.0 redis-server /etc/redis/redis.conf
//配置文件需要允许远程访问 bind 0.0.0.0
docker pull nacos/nacos-server:v1.4.5-slim
搭建临时nacos容器
docker run --name nacos -d -p 8848:8848 -e MODE=standalone nacos/nacos-server:v1.4.5-slim
从临时容器中复制 Nacos 配置文件
docker cp nacos:/home/nacos/logs/ /Users/liuhao/docker/nacos
docker cp nacos:/home/nacos/conf/ /Users/liuhao/docker/nacos
docker cp nacos:/home/nacos/data/ /Users/liuhao/docker/nacos
删除临时容器
docker rm -f nacos
修改 Nacos 配置文件 application.properties
vim /Users/liuhao/docker/nacos/conf/application.properties
修改配置文件/数据库信息
server.contextPath=/nacos
server.servlet.contextPath=/nacos
server.port=8848
spring.datasource.platform=mysql
db.num=1
db.url.0=jdbc:mysql://host.docker.internal:3306/nacos_config?characterEncoding=utf8&connectTimeout=1000&socketTimeout=3000&autoReconnect=true
db.user=root
db.password=root
nacos.cmdb.dumpTaskInterval=3600
nacos.cmdb.eventTaskInterval=10
nacos.cmdb.labelTaskInterval=300
nacos.cmdb.loadDataAtStart=false
management.metrics.export.elastic.enabled=false
management.metrics.export.influx.enabled=false
server.tomcat.accesslog.enabled=true
server.tomcat.accesslog.pattern=%h %l %u %t "%r" %s %b %D %{User-Agent}i
nacos.security.ignore.urls=/,/**/*.css,/**/*.js,/**/*.html,/**/*.map,/**/*.svg,/**/*.png,/**/*.ico,/console-fe/public/**,/v1/auth/login,/v1/console/health/**,/v1/cs/**,/v1/ns/**,/v1/cmdb/**,/actuator/**,/v1/console/server/**
nacos.naming.distro.taskDispatchThreadCount=1
nacos.naming.distro.taskDispatchPeriod=200
nacos.naming.distro.batchSyncKeyCount=1000
nacos.naming.distro.initDataRatio=0.9
nacos.naming.distro.syncRetryDelay=5000
nacos.naming.data.warmup=true
nacos.naming.expireInstance=true
启动
# 带配置信息的启动
docker run -d \
--name nacos \
-p 8848:8848 \
-e MODE=standalone \
-v /Users/liuhao/docker/nacos/logs/:/home/nacos/logs \
-v /Users/liuhao/docker/nacos/conf/:/home/nacos/conf \
-v /Users/liuhao/docker/nacos/data/:/home/nacos/data \
--restart=always \
nacos/nacos-server:v1.4.5-slim
原文链接:https://www.jianshu.com/p/4b60e370a4e9
docker pull mongo:latest
#创建所需文件夹
/Users/liuhao/docker/mongo
mkdir ./logs
mkdir -p ./{config,data,docker-entrypoint-initdb.d}
mkdir ./data/db
#创建配置文件
touch ./config/mongod.conf
#配置文件内容
storage:
dbPath: /data/db
journal:
enabled: true
systemLog:
destination: file
logAppend: true
path: /var/log/mongodb/mongod.log
net:
port: 27017
bindIp: 0.0.0.0
processManagement:
timeZoneInfo: /usr/share/zoneinfo
#创建parse_server_database的账户和密码
touch ./docker-entrypoint-initdb.d/mongo-init.js
#js文件内容
db.createUser({
user: 'mongo',
pwd: 'mongo',
roles: [
{
role: 'dbOwner',
db: 'parse_server_database',
},
],
});
#启动
docker run -d \
-p 27017:27017 \
-v /Users/liuhao/docker/mongo/data/db:/data/db \
-v /Users/liuhao/docker/mongo/config/mongod.conf:/etc/mongo/mongod.conf \
-v /Users/liuhao/docker/mongo/docker-entrypoint-initdb.d:/docker-entrypoint-initdb.d \
-v /Users/liuhao/docker/mongo/logs:/var/log/mongodb \
-e MONGO_INITDB_ROOT_USERNAME=root \
-e MONGO_INITDB_ROOT_PASSWORD=root \
-e MONGO_INITDB_DATABASE=parse_server_database \
--restart=always \
--name=mongo \
mongo --config /etc/mongo/mongod.conf
docker pull elasticsearch:7.16.2
#本地创建目录
mkdir /Users/liuhao/docker/elasticsearch/config
mkdir /Users/liuhao/docker/elasticsearch/data
mkdir /Users/liuhao/docker/elasticsearch/plugins
echo "http.host: 0.0.0.0" >> /Users/liuhao/docker/elasticsearch/config/elasticsearch.yml
docker run --name elasticsearch -p 9200:9200 -p 9300:9300 \
-e "discovery.type=single-node" \
-e ES_JAVA_OPTS="-Xms64m -Xmx512m" \
-v /Users/liuhao/docker/elasticsearch/config/elasticsearch.yml:/usr/share/elasticsearch/config/elasticsearch.yml \
-v /Users/liuhao/docker/elasticsearch/data:/usr/share/elasticsearch/data \
-v /Users/liuhao/docker/elasticsearch/plugins:/usr/share/elasticsearch/plugins \
-d elasticsearch:7.16.2
#尽量要和es版本一致
docker pull kibana:7.16.2
#查询elasticsearch中的内部ip
docker run --name kibana -e ELASTICSEARCH_HOSTS=http://172.17.0.4:9200 -p 5601:5601 -d kibana:7.16.2
#设置中文
#1 查看容器id
docker ps
#2 进入容器
docker exec -it Kibana容器id bash
#3 进入config 目录下
cd config/
#4 编辑 kibana.yml 文件
vi kibana.yml
#5 添加一行配置
i18n.locale: "zh-CN"
Es + kibana 原文链接 https://www.cnblogs.com/benjieqiang/p/17501293.html
设置中文原文链接 https://blog.csdn.net/weixin_46035332/article/details/113857284
docker pull minio/minio
docker run -p 9009:9000 -p 9090:9090 \
--name minio \
-d --restart=always \
-e "MINIO_ROOT_USER=minio" \
-e "MINIO_ROOT_PASSWORD=minioadmin" \
-v /Users/liuhao/docker/minio/data:/data \
-v /Users/liuhao/docker/minio/config:/root/.minio \
-v /Users/liuhao/docker/minio/logs:/var/log/minio \
minio/minio server \
/data --console-address ":9000" -address ":9090"
docker pull qinchz/dm8-arm64
本地创建挂载目录并启动
docker run -p 5236:5236 --name dm8 \
-v /Users/liuhao/docker/dm8:/home/dmdba/data \
-d qinchz/dm8-arm64