创建 nginx
docker run -d --name nginx \
-v /fx_logs/docker/nginx/www:/www \
-v /fx_logs/docker/nginx/conf/nginx.conf:/etc/nginx/nginx.conf \
-v /fx_logs/docker/nginx/conf/conf.d:/etc/nginx/conf.d \
-p 80:80 \
--restart=always \
--network fx_network \
nginx:latest
创建 mysql
docker run -d --name mysql \
-v /fx_logs/docker/mysql/conf:/etc/mysql \
-v /fx_logs/docker/mysql/logs:/var/log/mysql \
-v /fx_logs/docker/mysql/data:/var/lib/mysql \
-v /fx_logs/docker/mysql/conf/my.cnf:/etc/mysql/my.cnf \
-p 3306:3306 \
-e MYSQL_ROOT_PASSWORD=123!#%456 \
--restart=always \
--network fx_network \
mysql:5.7.36
创建 elasticsearch 可以创建多个集群
docker run -d --name es_node1 \
-v /fx_logs/docker/es/config/es_node1_6.8.20.yml:/usr/share/elasticsearch/config/elasticsearch.yml \
-v /fx_logs/docker/es/config/certs:/usr/share/elasticsearch/config/certs \
-v /fx_logs/docker/es/plugins:/usr/share/elasticsearch/plugins \
-v /fx_logs/docker/es/data/node1:/usr/share/elasticsearch/data \
-v /etc/localtime:/etc/localtime \
-e ES_JAVA_OPTS="-Xms4G -Xmx4G" \
--restart=always \
--network fx_network \
elasticsearch:6.8.20
创建 redis 并以配置文件进行启动
docker run -p 6379:6379 --name myredis -v /logs/docker/redis_6379/data:/data -v /logs/docker/redis_6379/redis.conf:/etc/redis/redis.conf -d redis redis-server /etc/redis/redis.conf --appendonly yes