Dockerfile

  

 

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

 

Dockerfile

上一篇:vscode ctrl+P 打开文件后固定文件


下一篇:K8S中使用gfs当存储