docker run -p 8500:8500 --name consul -v /home/milk/docker/consul/conf:/consul/conf/ -v /home/milk/docker/consul/data:/consul/data -d consul
docker run -p 3306:3306 --name mysql -v /home/milk/docker/mysql/conf:/etc/mysql/conf.d -v /home/milk/docker/mysql/logs:/logs -v /home/milk/docker/mysql/data:/var/lib/mysql -e MYSQL_ROOT_PASSWORD=root -d mysql
docker run -d --name jenkins -p 8080:8080 -p 50000:50000 -v /home/milk/docker/jenkins_hom:/var/jenkins_home ba607c18aeb7
docker run -d -p 5671:5671 -p 5672:5672 -p 15672:15672 -p 15671:15671 -p 25672:25672 -v /home/milk/data/rabbitmq-data/:/var/rabbitmq/lib --name rabbitmq rabbitmq
# 拉取镜像
$ docker pull sonatype/nexus3
# 创建本地挂载文件夹
$ mkdir -p /home/milk/docker/nexus-data
# 设置挂载文件夹权限
$ sudo chown -R 200:200 /home/milk/docker/nexus-data
# 启动sonatype/nexus3镜像
$ docker run -d -p 8081:8081 --name nexus -v /home/milk/docker/nexus-data:/nexus-data sonatype/nexus3
$ docker run -d -p 27017:27017 --name mongo -v /my/milk/docker/datadir:/data/db mongo
# 使用数据库`study`
use study
# 创建用户
db.createUser({user:'study',pwd:'123',roles:[{role:'readWrite',db:'study'}]})
# 检查用户,返回`1`则表示认证成功
db.auth('study','123')
docker run -p 80:80 --name mynginx -v /Users/milk/docker/nginx/html:/usr/share/nginx/html -v /Users/milk/docker/nginx/conf.d:/etc/nginx/conf.d -d nginx
appendonly yes:表示启动持久化
docker run -p 6379:6379 -v /home/milk/docker/redis/data:/data -d redis redis-server --appendonly yes
# 进入
docker exec -it 容器id bash
docker-compose.yml
文件(docker-hub上有文件,直接拷贝使用)修改映射地址
mongo-volumes
,redis-volumes
,web-volumes
version: '3'
services:
mongodb:
image: mongo
volumes:
# ./data/db 数据库文件存放地址,根据需要修改为本地地址
- '/home/milk/docker/mongo/datadir'
networks:
- easy-mock
restart: always
redis:
image: redis
command: redis-server --appendonly yes
volumes:
# ./data/redis redis 数据文件存放地址,根据需要修改为本地地址
- '/home/milk/docker/redis/data'
networks:
- easy-mock
restart: always
web:
image: easymock/easymock
command: /bin/bash -c "npm start"
ports:
- 7300:7300
volumes:
# 日志地址,根据需要修改为本地地址
- './logs:/home/milk/file/easy-mock/logs'
# 配置地址,请使用本地配置地址替换
- './production.json:/home/milk/docker/file/easy-mock/production.json'
networks:
- easy-mock
restart: always
networks:
easy-mock:
production.json
{
"port": 7300,
"host": "0.0.0.0",
"pageSize": 30,
"proxy": false,
"db": "mongodb://mongodb/easy-mock", //一定要使用mongodb,不要使用`localhost`
"unsplashClientId": "",
"redis": {
"keyPrefix": "[Easy Mock]",
"port": 6379,
"host": "redis", //一定要使用redis,不要使用`localhost`
"password": "",
"db": 0
},
"blackList": {
"projects": [], // projectId,例:"5a4495e16ef711102113e500"
"ips": [] // ip,例:"127.0.0.1"
},
"rateLimit": { // https://github.com/koajs/ratelimit
"max": 1000,
"duration": 1000
},
"jwt": {
"expire": "14 days",
"secret": "shared-secret"
},
"upload": {
"types": [".jpg", ".jpeg", ".png", ".gif", ".json", ".yml", ".yaml"],
"size": 5242880,
"dir": "../public/upload",
"expire": {
"types": [".json", ".yml", ".yaml"],
"day": -1
}
},
"ldap": {
"server": "", // 设置 server 代表启用 LDAP 登录。例:"ldap://localhost:389" 或 "ldaps://localhost:389"(使用 SSL)
"bindDN": "", // 用户名,例:"cn=admin,dc=example,dc=com"
"password": "",
"filter": {
"base": "", // 查询用户的路径,例:"dc=example,dc=com"
"attributeName": "" // 查询字段,例:"mail"
}
},
"fe": {
"copyright": "",
"storageNamespace": "easy-mock_",
"timeout": 25000,
"publicPath": "/dist/"
}
}
docker run -d -p 8848:8848 --name nacos --privileged=true --restart=always -e JVM_XMS=521m -e JVM_XMX=2058m -e MODE=standalone -e PREFER_HOST_MODE=hostname -v /home/milk/docker/nacos/logs:/home/nacos/logs nacos/nacos-server