docker centos7创建consul镜像以及用docker-compose启动镜像
直接贴代码了:
Dockfile:
# Version 0.1 FROM kuba_centos7 MAINTAINER kuba si812cn@163.com # This is the release of Consul to pull in.
ENV CONSUL_VERSION=1.4.0
# This is the location of the releases.
ENV HASHICORP_RELEASES=https://releases.hashicorp.com # Create a consul user and group first so the IDs get set the same way, even as
# the rest of this may change over time. # Set up certificates, base tools, and Consul. RUN yum -y install ca-certificates gnupg libcap iputils \
&& yum clean all \
&& export CC=/opt/rh/devtoolset-6/root/usr/bin/gcc \
&& export CXX=/opt/rh/devtoolset-6/root/usr/bin/g++ \
&& groupadd consul \
&& useradd -r -g consul consul -s /bin/false \
&& mkdir -p /opt/software \
&& cd /opt/software/ \
&& gpg --keyserver pgp.mit.edu --recv-keys 91A6E7F85D05C65630BEF18951852D87348FFC4C \
&& wget ${HASHICORP_RELEASES}/consul/${CONSUL_VERSION}/consul_${CONSUL_VERSION}_linux_amd64.zip \
&& wget ${HASHICORP_RELEASES}/consul/${CONSUL_VERSION}/consul_${CONSUL_VERSION}_SHA256SUMS \
&& wget ${HASHICORP_RELEASES}/consul/${CONSUL_VERSION}/consul_${CONSUL_VERSION}_SHA256SUMS.sig \
&& gpg --batch --verify consul_${CONSUL_VERSION}_SHA256SUMS.sig consul_${CONSUL_VERSION}_SHA256SUMS \
&& grep consul_${CONSUL_VERSION}_linux_amd64.zip consul_${CONSUL_VERSION}_SHA256SUMS | sha256sum -c \
&& mkdir /usr/local/consul \
&& unzip -o consul_${CONSUL_VERSION}_linux_amd64.zip -d /usr/local/bin \
&& consul --version \
&& mkdir -p /consul/data \
&& mkdir -p /consul/config \
&& chown -R consul:consul /consul \
&& echo 'hosts: files dns' > /etc/nsswitch.conf # Expose the consul data directory as a volume since there's mutable state in there.
VOLUME /consul/data # Server RPC is used for communication between Consul clients and servers for internal
# request forwarding. EXPOSE 8300 # Serf LAN and WAN (WAN is used only by Consul servers) are used for gossip between
# Consul agents. LAN is within the datacenter and WAN is between just the Consul
# servers in all datacenters.
EXPOSE 8301 8301/udp 8302 8302/udp # HTTP and DNS (both TCP and UDP) are the primary interfaces that applications
# use to interact with Consul.
EXPOSE 8500 8600 8600/udp # Consul doesn't need root privileges so we run it as the consul user from the
# entry point script. The entry point script also uses dumb-init as the top-level
# process to reap any zombie processes created by Consul sub-processes.
ENTRYPOINT [consul] # By default you'll get an insecure single-node development server that stores
# everything in RAM, exposes a web UI and HTTP endpoints, and bootstraps itself.
# Don't use this configuration for production.
CMD ["agent", "-dev", "-client", "0.0.0.0"]
docker build -t kuba_consul140 ./
中间如果失败,一般是网络问题,隔断时间重新执行一次就好
创建docker-compose文件
# Copyright IBM Corp. All Rights Reserved.
#
# SPDX-License-Identifier: Apache-2.0
# version: '2' services:
consul140_0:
image: kuba_consul140
restart: always
container_name: consul140_0
volumes:
- ./data/:/consul/data/
ports:
- 8300:8300
- 8301:8301
- 8301:8301/udp
- 8302:8302
- 8302:8302/udp
- 8500:8500
- 8600:8600
- 8600:8600/udp
entrypoint: consul
command: agent -server -data-dir=/consul/data -config-dir=/consul/config -bootstrap -node=consul1140_0 -client=0.0.0.0
启动镜像:
docker-compose -f docker-compose-consul.yaml up -d 2>&1
查看镜像是否启动成功:
docker ps
查看consul
docker exec -t xxxx容器编号 consul members
docker centos7创建consul镜像以及用docker-compose启动镜像的更多相关文章
- Centos7创建支持ssh服务的docker镜像
如何在centos7中使用docker创建一个支持ssh连接的容器 1.拉取centos7.4镜像(由于7.4目前是最稳定的版本,所以推荐使用centos7.4) docker pull centos ...
- centos7创建docker tomcat镜像
1 准备宿主系统 准备一个 CentOS 7操作系统,具体要求如下: 必须是 64 位操作系统 建议内核在 3.8 以上 通过以下命令查看您的 CentOS 内核: 1 # uname -r 2 安装 ...
- docker Dockerfile 创建镜像
Docker 组件 1. docker client : docker的客户端 2. docker server : docker daemon的主要组成部分,接受用户通过docker client发 ...
- Centos7 创建本地 docker 仓库极其遇到的问题
环境安装: VirtualBox 安装 Centos7 安装 docker 1. 配置私有仓库和客户端地址 私有仓库:192.168.1.104 客户端:192.168.1.103 通过 Centos ...
- Docker 创建镜像、修改、上传镜像
Docker 创建镜像.修改.上传镜像 –创建镜像有很多方法,用户可以从 Docker Hub 获取已有镜像并更新,也可以利用本地文件系统创建一个. 一.创建镜像 创建镜像有很多方法,用户可以从 Do ...
- docker——Dockerfile创建镜像
写在前面: 继续docker的学习,昨天用docker成功跑了tomcat,但是在centos中镜像跑的容器手动装jdk和tomcat,今天学习用Dockerfile创建镜像,并在上面搭建java环境 ...
- 转 docker创建私有仓库和k8s中使用私有镜像
docker私有仓库建立 环境说明我们选取192.168.5.2做私有仓库地址yum install docker -y1.启动docker仓库端口服务 docker run -d -p 5000:5 ...
- Docker(十一)-Docker commit创建镜像
创建镜像有很多方法,用户可以从 Docker Hub 获取已有镜像并更新,也可以利用本地文件系统创建一个. 修改已有的镜像 查看已有的镜像: $ sudo docker images REPOSITO ...
- 两种方式创建支持SSH服务的docker镜像
方法一:基于commit命令创建 1.首先,从docker的源中查看我们需要的镜像,本案例中使用Ubuntu作为基础镜像. # federico @ linux in ~ [16:57:38] $ s ...
随机推荐
- Vue mixins(混入)
建立一个公共组件,然后对该组件进行混入继承. 注意会走两个生命周期,谨慎使用 mixins混入,相当于生成new 组件:组件引用,相当与在父组件内开辟了一块单独的空间 mixins适用于,两个有非常相 ...
- 『TensorFlow』TFR数据预处理探究以及框架搭建
一.TFRecord文件书写效率对比(单线程和多线程对比) 1.准备工作 # Author : Hellcat # Time : 18-1-15 ''' import os os.environ[&q ...
- 配置react, redux, next.js环境
1. react https://reactjs.org/docs/add-react-to-a-new-app.html npm install -g create-react-app create ...
- 【转载】koa相关知识(来自官网)
什么是Koa? koa 是由 Express 原班人马打造的,致力于成为一个更小.更富有表现力.更健壮的 Web 框架.使用 koa 编写 web 应用,通过组合不同的 generator,可以免除重 ...
- delete 与 delete []
/* Module: delete与delete[]的区别.cpp Notices: Copyright (c) 2017 Landy Tan */ #include <iostream> ...
- python高级变量类型(元组,列表,字典, 字符串和重要方法)
高级变量类型 目标 列表 元组 字典 字符串 公共方法 变量高级 知识点回顾 Python 中数据类型可以分为 数字型 和 非数字型 数字型 整型 (int) 浮点型(float) 布尔型(bool) ...
- oracle 链接
<properties> <!--配置Hibernate方言 --> <property name="hibernate.dialect" value ...
- TensorFlow 神经网络相关函数
TensorFlow 激活函数 激活操作提供用于神经网络的不同类型的非线性.这些包括平滑的非线性(sigmoid,tanh,elu,softplus,和softsign),连续的,但不是到处可微函数( ...
- elasticsearch 使用快照进行备份
Elasticsearch也提供了备份集群中索引数据的策略——snapshot API.它会备份整个集群的当前状态和数据,并保存到集群中各个节点共享的仓库中.这个备份的进程是增量备份的,在第一次备份的 ...
- 解决Error parsing SQL Mapper Configuration. Cause: java.io.IOException: Could not find resource com/cqupt/paging/dao/User.xml
搭建了一个ssm项目,启动报错Error parsing SQL Mapper Configuration. Cause: java.io.IOException: Could not find re ...