常用软件镜像的使用

1、Mysql

docker-compose.yml

version: '3'
services:
  mysql:
    image: mysql:5.7.23
    #容器名称
    container_name: mysql5.7.23
    #network_mode: "host"
    #随Docker启动
    restart: always
    ports:
      - "3306:3306"
    environment:
      #root用户密码
      MYSQL_ROOT_PASSWORD: *****
    volumes:
       #自定配置
       - ./conf:/etc/mysql/conf.d
       #数据挂载
       - ./data:/var/lib/mysql

my.cnf

[mysqld]
# disable_ssl 关闭SSL 
skip_ssl
#不启动grant-tables,授权表 修改授权时使用
#skip-grant-tables
#大小写忽略
lower_case_table_names=1

2、Redis

docker-compose.yml

version: '3'
services:
  redis:
    image: redis:latest
    #容器名称
    container_name: redis
    #network_mode: "host"
    #随Docker启动
    restart: always
    ports:
      - "6379:6379"
    volumes:
       #数据挂载
       - ./conf/redis.conf:/usr/local/etc/redis/redis.conf
       - ./data:/data
    command: redis-server --requirepass sysdba --appendonly yes --notify-keyspace-events Eglx

redis.conf

# bind 127.0.0.1 //加上注释#
port 6379  //绑定自定义端口
protected-mode no //关闭保护模式
#daemonize yes //禁止redis后台运行
#requirepass 123456 // 密码
# 集群相关配置
pidfile /var/run/redis_6061.pid 
cluster-enabled yes //开启集群 把注释#去掉
cluster-config-file nodes_6061.conf //集群的配置 配置文件首次启动自动生成

3、Zookeeper

docker-compose.yml

version: '3.1'

services:
  zoo1:
    image: zookeeper
    restart: always
    hostname: zoo1
    ports:
      - 2181:2181
    environment:
      ZOO_MY_ID: 1
      ZOO_SERVERS: server.1=0.0.0.0:2888:3888 server.2=zoo2:2888:3888 server.3=zoo3:2888:3888
  zoo2:
    image: zookeeper
    restart: always
    hostname: zoo2
    ports:
      - 2182:2181
    environment:
      ZOO_MY_ID: 2
      ZOO_SERVERS: server.1=zoo1:2888:3888 server.2=0.0.0.0:2888:3888 server.3=zoo3:2888:3888
  zoo3:
    image: zookeeper
    restart: always
    hostname: zoo3
    ports:
      - 2183:2181
    environment:
      ZOO_MY_ID: 3
      ZOO_SERVERS: server.1=zoo1:2888:3888 server.2=zoo2:2888:3888 server.3=0.0.0.0:2888:3888

4、Tomcat

docker-compose.yml

version: '3'
services:
  dubbo:
    image: tomcat:latest
    ports:
      # 
      - "80:8080"
    volumes:
      - ./xxxx.war:/usr/local/tomcat/webapps/xxxx.war
// 访问地址
宿主ip/xxxx

5、Jenkins

docker-compose.yml

version: '3'
services:
  jenkins:
    image: jenkins/jenkins:lts
    ports:
      - "8080:8080"
      - "50000:50000"
    volumes:
      - ./jenkins_home:/var/jenkins_home
      # JDK
      - /usr/local/service/jdk1.8.0_181:/usr/local/service/jdk1.8.0_181
      # Maven
      - /usr/local/service/maven-3.5.4:/usr/local/service/maven-3.5.4
      - /usr/local/service/maven-jars:/usr/local/service/maven-jars
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值