wget http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo -O /etc/yum.repos.d/docker-ce.repo
yum install docker-ce -y
//启动
service docker start
//设置开机启动
systemctl enable docker
//国内镜像源设置 https://blog.csdn.net/whatday/article/details/86770609
vi /etc/docker/daemon.json
{
"registry-mirrors": ["http://hub-mirror.c.163.com","https://registry.docker-cn.com","https://cr.console.aliyun.com","https://docker.mirrors.ustc.edu.cn"]
}
//重启docker
systemctl restart docker.service
//安装docker管理工具【可选】
docker run --restart always -d -p 9000:9000 -p 8000:8000 --name portainer --restart always -v /var/run/docker.sock:/var/run/docker.sock -v portainer_data:/data portainer/portainer
//安装pgsql【可选】
docker run --restart always -d \
--name my-postgres \
-e POSTGRES_PASSWORD= \
-v /pgsqlData/datas:/var/lib/postgresql/data \
-p 5432:5432 postgres:11.8
//安装pgsql管理工具【可选】
docker run --restart always -p 8080:80 \
-e ‘PGADMIN_DEFAULT_EMAIL=‘ \
-e ‘PGADMIN_DEFAULT_PASSWORD=‘ \
-d dpage/pgadmin4
//安装Redis【可选】
docker run -d --restart=always --privileged=true -p 6379:6379 --restart always -v /root/docker/redis/conf/redis.conf:/etc/redis/redis.conf -v /root/docker/redis/data:/data --name myredis redis redis-server /etc/redis/redis.conf --appendonly yes
//安装Mq【可选】
docker run -d --restart=always --name rabbitmq -p 5672:5672 -p 15672:15672 -v /usr/data/rabbitmq/data:/var/lib/rabbitmq --hostname myRabbit -e RABBITMQ_DEFAULT_VHOST=my_vhost -e RABBITMQ_DEFAULT_USER=guest -e RABBITMQ_DEFAULT_PASS=guest rabbitmq:3.7.7-management
//安装ELK【可选】https://www.cnblogs.com/fbtop/p/11005469.html
//记得挂载
docker run -d --restart always --name elasticsearch --net somenetwork -p 9200:9200 -p 9300:9300 -e "discovery.type=single-node" elasticsearch:7.1.1
docker run -d --restart always --name kibana --net somenetwork -p 5601:5601 kibana:7.1.1
docker run -it -d -p 5044:5044 --name logstash --restart always --net somenetwork -v /root/docker/logstash/logstash.yml:/usr/share/logstash/config/logstash.yml -v /root/docker/logstash/conf.d/:/usr/share/logstash/conf.d/ logstash:7.1.1
Docker 安装Redis、MySql、ELK、RabbitMq
原文:https://blog.51cto.com/14904200/2558156