首页 > 其他 > 详细

Dockerfile

时间:2021-07-15 23:50:33      阅读:25      评论:0      收藏:0      [点我收藏+]

  

 

FROM ubuntu
MAINTAINER b<b@b.b>
ENV path /usr/local
WORKDIR $path
RUN date
RUN apt update
RUN apt -y install vim
EXPOSE 22
CMD echo $path
CMD /bin/bash

  

FROM centos
MAINTAINER b<b@b.b>
COPY README.md /usr/local/share

ADD apache-tomcat-9.0.50.tar.gz /usr/local
ADD jdk-8u291-linux-x64.tar.gz /usr/local

RUN yum -y install vim
ENV path /usr/local
WORKDIR $path

ENV JAVA_HOME /usr/local/jdk1.8.0_291
ENV CATALINA_HOME /usr/local/apache-tomcat-9.0.50
ENV PATH $PATH:$JAVA_HOME/bin:$CATALINA_HOME/bin

EXPOSE 8080

CMD catalina.sh start && tail -F $CATALINA_HOME/logs/catalina.out

  

redis cluster

docker network create redis --subnet 172.38.0.0/116 --driver bridge --gateway 172.38.0.1 

  

for n in $(seq 1 1 6);do
  mkdir -p /data/redis/node-${n}/conf
  cat > /data/redis/node-${n}/conf/redis.conf <<eof
  port 6379
  bind 0.0.0.0
  cluster-enabled yes
  cluster-config-file nodes.conf
  cluster-node-timeout 5000
  cluster-announce-ip 172.38.0.1${n}
  cluster-announce-port 6379
  cluster-announce-bus-port 16379
  appendonly yes
eof
done

  

for ((i=1;i<7;++i))
do
	docker run -d --network redis --name redis-$i 	-p 637$i:6379 --ip 172.38.0.1$i 	-v /data/redis/node-$i/data:/data 	-v /data/redis/node-$i/conf/redis.conf:/etc/redis/redis.conf 	redis:5.0.9-alpine3.11 redis-server /etc/redis/redis.conf
done

  

docker exec -it redis-1 sh

# proceed in container redis-1
redis-cli --cluster create 172.38.0.11:6379 172.38.0.12:6379 172.38.0.13:6379 172.38.0.14:6379 172.38.0.15:6379 172.38.0.16:6379 --cluster-replicas 1

redis-cli -c

cluster info

set a b

cluster nodes

docker stop redis-3

quit

redis-cli -c

get a

cluster nodes

  技术分享图片

 

Dockerfile

原文:https://www.cnblogs.com/dissipate/p/15018027.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!