sudo apt-get install docker-ce=5:20.10.6~3-0~debian-bullseye docker-ce-cli=5:20.10.6~3-0~debian-bullseye containerd.io
docker 部署项目信息:--172.17.0.1 172.16.22.40
1、docker 部署 tomcat
docker run -d --name stock-admin --restart always -p 81:8080 -e "TZ=Asia/Shanghai" -v /opt/project/stock/web-tomcat/logs:/usr/local/local/log -v /opt/project/stock/web-tomcat/webapps:/usr/local/tomcat/webapps tomcat:9.0.20-jre8-slim
2、部署redis
docker run -d -p 6379:6379 --name redis \
-v /opt/project/stock/redis/redis.conf:/etc/redis/redis.conf \
-v /opt/project/stock/redis/data:/data \
redis:alpine redis-server /etc/redis/redis.conf
#进入redis内部命令
docker exec -it 48c0129aa60a redis-cli
3、部署es 8.6.2
docker run -d -p 9200:9200 -p 9300:9300 -e "discovery.type=single-node" -e "TZ=Asia/Shanghai" -e "ES_JAVA_OPTS=-Xms512m -Xmx512m" -v /opt/elasticsearch/data:/usr/share/elasticsearch/data -v /opt/elasticsearch/logs:/usr/share/elasticsearch/logs -v /opt/elasticsearch/elasticsearch.yml:/usr/share/elasticsearch/config/elasticsearch.yml --name es-node elasticsearch:8.6.2
#自动创建的文件夹,可能需要手动分配权限
curl -XPUT 'http://127.0.0.1:9200/_settings' -H 'Content-Type: application/json' -d ' { "index" : { "number_of_replicas" : 0 } }'
4、部署springboot 项目
docker run -d --name stock-es --restart always -p 8000:8000 -v /opt/project/stock-es/logs:/app/log -e "TZ=Asia/Shanghai" amaizi/stock
docker update CONTAINER
5、部署nginx
docker pull nginx
docker run -e TZ="Asia/Shanghai" -d -p 80:80 -p 443:443 --name web-nginx -v /opt/project/stock/web-nginx/nginx.conf:/etc/nginx/nginx.conf -v /opt/project/stock/web-nginx/certs:/etc/nginx/certs -v /opt/project/stock/web-nginx/logs:/var/log/nginx -v /opt/project/stock/web-tomcat/webapps/ROOT/WEB-INF/classes/static:/etc/nginx/static nginx
///部署es
#!/bin/bash
data="/data1/docker_elk/elasticsearch/data/"
logs="/data1/docker_elk/elasticsearch/logs/"
# 授权目录,必须授权,要不启动报错
chmod 777 $data
chmod 777 $logs
docker_name=elasticsearch
docker stop $docker_name
docker rm $docker_name
docker run --name=es-node -p 9200:9200 -p 9300:9300 --ulimit nofile=65535:65535 --ulimit memlock=-1:-1 -e "bootstrap.memory_lock=true" -e ES_JAVA_OPTS="-Xms1g -Xmx1g" -v /opt/elasticsearch/data:/usr/share/elasticsearch/data -v /opt/elasticsearch/elasticsearch.yml:/usr/share/elasticsearch/config/elasticsearch.yml -v /opt/elasticsearch/logs:/usr/share/elasticsearch/logs -d docker.elastic.co/elasticsearch/elasticsearch:6.8.4
开发者启动
docker run -p 9200:9200 -p 9300:9300 -e "discovery.type=single-node" -d docker.elastic.co/elasticsearch/elasticsearch:
docker 部署项目信息:--172.17.0.1 172.16.22.40
1、docker 部署 tomcat
docker run -d --name stock-admin --restart always -p 81:8080 -e "TZ=Asia/Shanghai" -v /opt/project/stock/web-tomcat/logs:/usr/local/local/log -v /opt/project/stock/web-tomcat/webapps:/usr/local/tomcat/webapps tomcat:9.0.20-jre8-slim
2、部署redis
docker run -d -p 6379:6379 --name redis \
-v /opt/project/stock/redis/redis.conf:/etc/redis/redis.conf \
-v /opt/project/stock/redis/data:/data \
redis:alpine redis-server /etc/redis/redis.conf
#进入redis内部命令
docker exec -it 48c0129aa60a redis-cli
3、部署es 8.6.2
docker run -d -p 9200:9200 -p 9300:9300 -e "discovery.type=single-node" -e "TZ=Asia/Shanghai" -e "ES_JAVA_OPTS=-Xms512m -Xmx512m" -v /opt/elasticsearch/data:/usr/share/elasticsearch/data -v /opt/elasticsearch/logs:/usr/share/elasticsearch/logs -v /opt/elasticsearch/elasticsearch.yml:/usr/share/elasticsearch/config/elasticsearch.yml --name es-node elasticsearch:8.6.2
#自动创建的文件夹,可能需要手动分配权限
curl -XPUT 'http://127.0.0.1:9200/_settings' -H 'Content-Type: application/json' -d ' { "index" : { "number_of_replicas" : 0 } }'
4、部署springboot 项目
docker run -d --name stock-es --restart always -p 8000:8000 -v /opt/project/stock-es/logs:/app/log -e "TZ=Asia/Shanghai" amaizi/stock
docker update CONTAINER
5、部署nginx
docker pull nginx
docker run -e TZ="Asia/Shanghai" -d -p 80:80 -p 443:443 --name web-nginx -v /opt/project/stock/web-nginx/nginx.conf:/etc/nginx/nginx.conf -v /opt/project/stock/web-nginx/certs:/etc/nginx/certs -v /opt/project/stock/web-nginx/logs:/var/log/nginx -v /opt/project/stock/web-tomcat/webapps/ROOT/WEB-INF/classes/static:/etc/nginx/static nginx
///部署es
#!/bin/bash
data="/data1/docker_elk/elasticsearch/data/"
logs="/data1/docker_elk/elasticsearch/logs/"
# 授权目录,必须授权,要不启动报错
chmod 777 $data
chmod 777 $logs
docker_name=elasticsearch
docker stop $docker_name
docker rm $docker_name
docker run --name=es-node -p 9200:9200 -p 9300:9300 --ulimit nofile=65535:65535 --ulimit memlock=-1:-1 -e "bootstrap.memory_lock=true" -e ES_JAVA_OPTS="-Xms1g -Xmx1g" -v /opt/elasticsearch/data:/usr/share/elasticsearch/data -v /opt/elasticsearch/elasticsearch.yml:/usr/share/elasticsearch/config/elasticsearch.yml -v /opt/elasticsearch/logs:/usr/share/elasticsearch/logs -d docker.elastic.co/elasticsearch/elasticsearch:6.8.4
开发者启动
docker run -p 9200:9200 -p 9300:9300 -e "discovery.type=single-node" -d docker.elastic.co/elasticsearch/elasticsearch: