启动redis:
简单:docker run -d --name redis01 -p 6379:6379 redis --requirepass "123456"
复杂:docker run -d --privileged=true -p 26379:6379 -v /usr/local/docker/redis/conf/redis.conf:/etc/redis/redis.conf -v /usr/local/docker/redis/data:/data -v /usr/local/docker/redis/conf/data:/data --name redis redis redis-server /etc/redis/redis.conf --appendonly yes
启动es(设置JVM内存,外挂配置文件/usr/local/docker/elasticsearch/config/elasticsearch01.yml):
docker run --name elasticsearch01 -e ES_JAVA_OPTS="-Xms256m -Xmx256m" -d -p 9200:9200 -p 9300:9300 -v /usr/local/docker/elasticsearch/config/elasticsearch01.yml:/usr/share/elasticsearch/config/elasticsearch.yml -v /usr/local/docker/elasticsearch/data/:/usr/share/elasticsearch/data registry.docker-cn.com/library/elasticsearch
启动zk:
docker run -d --name zookeeper01 -p 2181:2181 zookeeper
启动mysql挂在外置文件
一、新建文件: mkdir -p /usr/local/docker/mysql/logs /usr/local/docker/mysql/conf /usr/local/docker/mysql/data
二、启动mysql :
将容器中MySQL的3306端口映射到本地的23306端口,并设置登录密码为:123456
docker run --name mysql5.7 -p 3306:3306 -e MYSQL_ROOT_PASSWORD=123456 -d mysql:5.7
docker run --privileged=true --name mysql5.7 -p 23306:3306 -v /usr/local/docker/mysql/data:/var/lib/mysql -v /usr/local/docker/mysql/conf/my.cnf:/etc/mysql/my.cnf -e MYSQL_ROOT_PASSWORD=123456 -d mysql:5.7
国内加速地址:
docker pull registry.docker-cn.com/library/elasticsearch
进入docker镜像内部
docker exec -it 镜像 /bin/bash
vi /etc/sysctl.conf
sysctl -p
网友评论