docker 安装启动 nginx mysql redis ElasticSearch Kibana 及多个tomcat 20200309

Nginx

docker pull nginx

第一步:docker run -d -p 8888:80 --name nginx-use  --net host -v /Users/damon/Downloads/docker/nginx/www:/usr/share/nginx/html -v /Users/damon/Downloads/docker/nginx/logs:/var/log/nginx nginx
第二步:docker exec -it nginx /bin/bash (进入容器 获取文件)
第三步:cd /etc/nginx/ (这里主要获取配置文件路径的)
第四步:exit
第五步:cd /docker/nginx/conf/
第六步:docker cp 4aa7fdf3db6d:/etc/nginx/nginx.conf .
ps:文件copy成功后 把nginx容器先删除掉
第七步:docker rm -f nginx
第八步:docker run -d -p 8888:80 --name nginx-use -v /Users/damon/Downloads/docker/nginx/www:/usr/share/nginx/html -v /Users/damon/Downloads/docker/nginx/conf/nginx.conf:/etc/nginx/nginx.conf -v /Users/damon/Downloads/docker/nginx/logs:/var/log/nginx nginx



Mysql

docker pull mysql:5.7
 

1.mkdir -p /Users/damon/Downloads/docker/mysql/data /Users/damon/Downloads/docker/mysql/logs /Users/damon/Downloads/docker/mysql/conf
2./root/mysql/conf中创建 *.cnf 文件
3.docker run -p 3306:3306 --name mysql --privileged=true -v /root/data/docker/mysql/logs:/logs  -v /root/data/docker/mysql/data:/var/lib/mysql  -v /root/data/docker/mysql/conf/my.cnf:/etc/mysql/mysql.conf.d/mysqld.cnf -e MYSQL_ROOT_PASSWORD=root -d mysql:5.7

Redis

1.dokcer pull redis
2.docker run -d -p 6379:6379 --name redis-use -v /Users/damon/Downloads/docker/redis/conf/redis.conf:/usr/local/etc/redis/redis.conf -v /Users/damon/Downloads/docker/redis/data:/data  redis redis-server /usr/local/etc/redis/redis.conf --appendonly yes


tomcat

docker pull tomcat:7


1. docker run -d --name tomat8081 -p 8081:8080 tomcat:7
2. docker run -d --name tomat8081 -p 8081:8080 tomcat:7
3. docker exec -it  tomcat8081 /bin/bash
4. exit
5. docker cp /User/test/HelloWorld.war tomcat8081:/usr/local/tomcat/webapps
6. docker cp /User/test/HelloWorld.war tomcat8082:/usr/local/tomcat/webapps
7. http://localhost:8081/HelloWorld
8. http://localhost:8082/HelloWorld

ElasticSearch


mkdir /Users/damon/Downloads/docker/elasticsearch/config

mkdir /Users/damon/Downloads/docker/elasticsearch/data
mkdir /Users/damon/Downloads/docker/elasticsearch/plugins
echo "http.host: 0.0.0.0" >> /Users/damon/Downloads/docker/elasticsearch/config/elasticsearch.yml

docker run --name elasticsearch -p 9200:9200 -p 9300:9300 \
-e "discovery.type=single-node" \
-e ES_JAVA_OPTS="-Xms64m -Xms128m" \
-v /Users/damon/Downloads/docker/elasticsearch/config/elasticsearch.yml:/usr/share/elasticsearch/config/elasticsearch.yml \
-v /Users/damon/Downloads/docker/elasticsearch/data:/usr/share/elasticsearch/data \
-v /Users/damon/Downloads/docker/elasticsearch/plugins:/usr/share/elasticsearch/plugins \
-d elasticsearch:7.4.2

Kibana

docker run --name kibana -e ELASTICSEARCH_HOSTS=http://192.168.106.210:9200 -p 5601:5601 -d kibana:7.4.2

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值