sudo yum remove docker \
docker-client \
docker-client-latest \
docker-common \
docker-latest \
docker-latest-logrotate \
docker-logrotate \
docker-engine
sudo yum install -y yum-utils \
device-mapper-persistent-data \
lvm2
sudo yum-config-manager \
--add-repo \
http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
sudo yum install docker-ce docker-ce-cli containerd.io
sudo systemctl start docker
systemctl enable docker
=====安转docker https://blog.csdn.net/qq_30665009/article/details/126586070
docker run -d \
--name mongodb \
--restart always \
--privileged \
-p 27017:27017 \
-v /mydata/data:/data/db \
mongo:4.2.2
mkdir -p /mydata/portainer/data
docker run -d \
-p 9000:9000 \
--name portainer \
--restart=always \
-v /var/run/docker.sock:/var/run/docker.sock \
-v /mydata/portainer/data:/data \
portainer/portainer
手动上传es安装包的方式
docker load -i /root/apps/es.tar
sudo docker network create es
sudo docker network create mysql
sudo docker network create zookeeper
#sudo docker network create dubbo
授权目录
chmod 777 /home/docker/es/**
查看权限
ls -l
=============用于记忆的https://blog.csdn.net/mah666/article/details/121153036=====================
#-v /mydata/es/config:/usr/share/elasticsearch/config \ 这句不用了,不然会报错
docker run \
--name es \
--privileged=true \
-p 9200:9200 \
-p 9300:9300 \
-v /mydata/es/data:/usr/share/elasticsearch/data \
-v /mydata/es/plugins:/usr/share/elasticsearch/plugins \
-e ES_JAVA_OPTS="-Xms512m -Xmx512m" \
-e "discovery.type=single-node" \
--net es \
--restart=always \
-d elasticsearch:7.9.3
以上需要把mydata文件夹设置为777权限
docker run \
--name kibana \
-p 5601:5601 \
-e ELASTICSEARCH_HOSTS=http://es:9200 \
--net es \
--restart=always \
-d kibana:7.9.3
#--net dubbo \
sudo docker run \
-d \
--name zookeeper \
--net zookeeper \
-v /mydata/zookeeper:/var/lib/zookeeper/data \
-p 2181:2181 \
-p 2888:2888 \
-p 3888:3888 \
--restart=always \
jplock/zookeeper:3.4.11
redis.conf文件示例内容:
save 900 1
save 300 10
save 60 10000
requirepass 420188
appendonly yes
chmod 777 redis.conf
docker run -p 6379:6379 \
--name redis \
-v /mydata/redis/conf/redis.conf:/etc/redis/redis.conf \
-v /mydata/redis/data:/data \
--restart=always \
-d redis:6.2.6 redis-server /etc/redis/redis.conf
#docker run --restart=always -itd --name redis -p 6379:6379 redis
https://blog.csdn.net/qq_40604437/article/details/106680762
mkdir -p /mydata/mysql/{data,conf}
============5.7安装的方式=======
docker run -p 3306:3306 --name mysql \
-v /mydata/mysql/log:/var/log/mysql \
-v /mydata/mysql/data:/var/lib/mysql \
-v /mydata/mysql/conf:/etc/mysql \
-e MYSQL_ROOT_PASSWORD=123456 \
--restart=always \
--network mysql \
-d mysql:5.7
//8 版本必须指定conf/my.cnf
docker run -p 3306:3306 \
--name mysql \
-v /mydata/mysql/conf/my.cnf:/etc/my.cnf \
-v /mydata/mysql/data:/var/lib/mysql \
--privileged=true \
--restart=always \
--network mysql \
-e MYSQL_ROOT_PASSWORD=123456 \
-d mysql:8.0.27
#-v `pwd`/data:/var/lib/rabbitmq \
docker run -d \
--restart=always \
--name rabbitmq3.7.7 \
-p 5672:5672 \
-p 15672:15672 \
-v /mydata/rabbitmq:/var/lib/rabbitmq \
--hostname myRabbit \
-e RABBITMQ_DEFAULT_VHOST=my_vhost \
-e RABBITMQ_DEFAULT_USER=admin \
-e RABBITMQ_DEFAULT_PASS=admin \
rabbitmq:3.7.7
rabbitmq-plugins enable rabbitmq_management
#docker cp nacos:/home/nacos/logs/ /mydata/nacos/
docker cp nacos:/home/nacos/conf/ /mydata/nacos/
docker cp nacos:/home/nacos/conf/application.properties /mydata/nacos/conf/application.properties
#-v /mydata/nacos/conf/application.properties:/home/nacos/conf/application.properties \
#https://blog.csdn.net/qq_26820793/article/details/130688074
######https://blog.csdn.net/qq_46310975/article/details/126848862
#https://blog.csdn.net/m0_37635053/article/details/115669679
#先生成一个application.properties,没有的话先不挂载属性文件,然后创建一个临时的nacos,
之后docker cp nacos:/home/nacos/conf/application.properties /mydata/nacos/conf/application.properties
出来一个,docker cp nacos:/home/nacos/conf/ /mydata/nacos/ 这个是拷贝全部的
https://blog.csdn.net/crazyman_gao/article/details/124277227
docker run --name nacos -p 8848:8848 \
--privileged=true \
--restart=always \
-e JVM_XMS=128m \
-e JVM_XMX=128m \
-e MODE=standalone \
-e PREFER_HOST_MODE=hostname \
-v /mydata/nacos/logs:/home/nacos/logs \
-v /mydata/nacos/conf/application.properties:/home/nacos/conf/application.properties \
--network mysql \
-d nacos/nacos-server:latest
#需要手动拷贝两个文件到conf中,一个属性文件,一个logback4用的日志文件
#https://blog.csdn.net/qq_46310975/article/details/126848862
docker run -d \
-p 8848:8848 \
--name nacos \
--privileged=true \
-e MODE=standalone \
-e JVM_XMS=256m \
-e JVM_XMX=256m \
-e PREFER_HOST_MODE=hostname \
-v /mydata/nacos/logs:/home/nacos/logs \
-v /mydata/nacos/conf:/home/nacos/conf \
--network mysql \
--restart=always \
nacos/nacos-server
docker pull docker.elastic.co/logstash/logstash:7.9.3
docker pull logstash:7.9.3
#docker volume create portainer_data
docker run -d \
-p 8000:8000 \
-p 9000:9000 \
--name portainer \
--restart=always \
-v /var/run/docker.sock:/var/run/docker.sock \
-v /mydata/portainer/data:/data \
portainer/portainer
首先需要停止所有的容器
docker stop $(docker ps -a -q)
删除所有的容器(只删除单个时把后面的变量改为container id即可)
docker rm $(docker ps -a -q)
强制删除所有镜像:
docker rmi -f $(docker images -q)