在Docker上部署常用的服务

RabbitMQ

https://store.docker.com/images/rabbitmq

1
2
3
4
5
6
7
8
9
10
11
docker run -d \
--name RabbitMQ \
-p 4369:4369 \
-p 5672:5672 \
-p 15672:15672 \
-p 25672:25672 \
-e RABBITMQ_DEFAULT_USER=user \
-e RABBITMQ_DEFAULT_PASS=password \
-v /home/app/rabbitmq:/var/lib/rabbitmq \
--restart=always \
rabbitmq:management-alpine

Redis

https://store.docker.com/images/redis

1
2
3
4
5
6
docker run -d \
--name Redis \
-p 6379:6379 \
-v /home/app/redis:/data \
--restart=always \
redis:alpine

MySQL

https://store.docker.com/images/mysql

1
2
3
4
5
6
7
docker run -d \
--name MySQL \
-p 3306:3306 \
-e MYSQL_ROOT_PASSWORD=root \
-v /home/app/mysql:/var/lib/mysql \
--restart=always \
mysql:5.7

Jenkins

https://store.docker.com/images/jenkins

1
2
3
4
5
6
docker run -d \
--name jenkins \
-p 8080:8080 \
-v /home/app/jenkins:/var/jenkins_home \
--restart=always \
jenkins:alpine

System.setProperty(‘org.apache.commons.jelly.tags.fmt.timeZone’, ‘Asia/Shanghai’)

gogs

https://store.docker.com/community/images/gogs/gogs

1
2
3
4
5
6
docker run -d \
--name gogs \
-p 3000:3000 \
-v /home/app/gogs:/data \
--restart=always \
gogs/gogs

nexus

https://store.docker.com/community/images/sonatype/nexus3

1
2
3
4
5
6
docker run -d \
--name nexus3 \
-p 8081:8081 \
-v /home/app/nexus3:/nexus-data \
--restart=always \
sonatype/nexus3
  • 如果启动遇到 Unable to update instance pid: No locks available
    • 请检查是不是用了NFS挂载 并且加了 --nolock

webide

https://store.docker.com/community/images/webide/webide

1
2
3
4
5
6
7
docker run -d \
--name webide \
-p 8080:8080 \
-v /home/app/webide:/root/.coding-ide \
-v /home/app/maven/repo:/root/.m2/repository \
--restart=always \
webide/webide

ELK(elasticsearch Logstash Kibabn)

https://hub.docker.com/r/sebp/elk/

注意: 系统参数 vm.max_map_count 必须大于等于 262144

1
2
3
4
5
6
7
8
9
10
11
12
13
docker run -d \
--name elk \
-p 5601:5601 \
-p 9200:9200 \
-p 5044:5044 \
-e TZ='Asia/Shanghai' \
-e MAX_MAP_COUNT=262144 \
-e MAX_OPEN_FILES=65536 \
-e ES_CONNECT_RETRY=300 \
-e KIBANA_CONNECT_RETRY=300 \
-v /home/app/elk:/var/lib/elasticsearch \
--restart=always \
sebp/elk

Swirl

1
2
3
4
5
6
7
docker run -d \
--name swirl \
-p 8001:8001 \
-e DB_ADDRESS=192.168.0.2:27017/swirl \
-v /var/run/docker.sock:/var/run/docker.sock \
--restart=always \
cuigh/swirl

Grafana

1
2
mkdir -p /home/app/grafana
chown 104 /home/app/grafana
1
2
3
4
5
6
7
8
9
docker run -d \
--name grafana \
--user 104 \
-p 3000:3000 \
-e GF_SERVER_ROOT_URL=https://grafana.yumc.pw \
-e GF_SECURITY_ADMIN_PASSWORD=123456 \
-v /home/app/grafana:/var/lib/grafana \
--restart=always \
grafana/grafana

Mongodb

1
2
3
4
5
6
docker run -d \
--name mongo \
-p 27017:27017 \
-v /home/app/mongodb:/data \
--restart=always \
mongo:4

Confluence

1
2
3
4
5
6
7
docker run -d \
--name confluence \
-p 8090:8090 \
-p 8091:8091 \
-v /home/app/confluence:/var/atlassian/confluence \
--restart=always \
miaowoo/confluence
  • 获取 License Code
1
docker exec -it $(docker ps -a | grep confluence | awk '{print $1}') java -jar /opt/atlassian/confluence/atlassian-agent.jar -m admin@xxxx.xx -n Admin -p conf -o https://xx.xxxx.com -s 序列号(XXXX-XXXX-XXXX-XXXX)