镜像构建

完成如下镜像的构建

完成如下镜像的构建
1.构建一个Tomcat镜像,暴漏端口8080和8443

FROM 10.30.12.55/docker/java
ADD apache-tomcat-9.0.14.tar.gz /root/usr/local/
WORKDIR /root/usr/local/apache-tomcat-9.0.14/bin/
EXPOSE 8080 8443

CMD ["./catalina.sh","run"]

2.构建一个Nginx镜像,暴漏端口80和443

FROM  10.30.12.55/docker/centos
RUN yum install -y epel-release && yum install -y nginx
EXPOSE 80 443

CMD ["nginx","-g","daemon off;"]

3.构建一个httpd镜像,暴漏端口80和443

FROM 10.30.12.55/docker/centos
RUN yum install -y httpd
EXPOSE 80 443

CMD ["httpd","-D","FOREGROUND"]

4.构建一个nginx+php环境的镜像,暴漏端口80和443
点我-参考这个文章即可---nginx源码安装请自行解决

按如下要求使用容器实现集群

4.请编写docker-compose模板文件,实现一键搭建zabbix系统,并成功实现监控上题的所有服务!

version: "3"
services:
  mysql:
    image: 10.30.12.55/docker/mysql:5.6
    environment:
      - MYSQL_ROOT_PASSWORD=123
      - MYSQL_DATABASE=zabbix
      - MYSQL_USER=tom
      - MYSQL_PASSWORD=123
    ports:
      - 3306:3306
    volumes:
      - /var/lib/mysql:/var/lib/mysql
    command: --character-set-server=utf8

  zabbix-server:
    image: 10.30.12.55/docker/zabbix-server
    environment:
      - DB_SERVER_HOST=mysql
      - DB_SERVER_PORT=3306
      - MYSQL_USER=tom
      - MYSQL_PASSWORD=123
      - MYSQL_DATABASE=zabbix
    ports:
      - 10051:10051
    depends_on:
      - mysql

  zabbix-web:
    image: 10.30.12.55/docker/zabbix-web-nginx
    environment:
      - DB_SERVER_HOST=mysql
      - DB_SERVER_PORT=3306
      - MYSQL_USER=tom
      - MYSQL_PASSWORD=123
      - MYSQL_DATABASE=zabbix
    ports:
      - 80:80
    depends_on:
      - mysql
      - zabbix-server

你可能感兴趣的:(镜像构建)