• docker配置项目镜像


    1、Dockerfile构建redis镜像
    redis_install.sh
    #!/bin/bash
    yum install -y gcc gcc-c++ make openssl openssl-devel
    cd /home/redis-6.2.6
    make && make PREFIX=/usr/local/redis install
    mkdir -p /usr/local/redis/conf/
    cp /home/redis-6.2.6/redis.conf /usr/local/redis/conf/
    sed -i '69s/127.0.0.1/0.0.0.0/' /usr/local/redis/conf/redis.conf
    sed -i '88s/protected-mode yes/protected-mode no/' /usr/local/redis/conf/redis.conf


    编写Dockerfile
    FROM centos:7
    ADD redis-6.2.6.tar.gz /home
    COPY redis_install.sh /home
    RUN sh /home/redis_install.sh
    ENTRYPOINT /usr/local/redis/bin/redis-server /usr/local/redis/conf/redis.conf

    制作redis镜像
    docker build -t mycentos:redis .

    启动容器
    docker run -itd -p 6376:6379 -v /usr/local/software/redis-6.2.6/redis.conf:/usr/local/redis/conf/redis.conf mycentos:redis


    2、安装mysql
    docker pull mysql:5.7

    启动命令
    docker run --name some-mysql -p 3306:3306 -e MYSQL_ROOT_PASSWORD=123456 -d mysql:5.7
    进入容器
    docker exec -it 429e6a0bd39d env LANG=C.UTF-8 /bin/bash


    3、安装nacos
    拉取镜像
    docker pull nacos/nacos-server

    docker run -d -p 8848:8848 --name nacos \
    --privileged=true \
    --restart=always \
    -e JVM_XMS=256m \
    -e JVM_XMX=256m \
    -e MODE=standalone \
    -e PREFER_HOST_MODE=hostname \
    nacos/nacos-server


    4、安装minio
    拉取镜像
    docker pull minio/minio
    启动容器
    docker run --name minio -p 9000:9000 -p 9090:9090 -d --restart=always \
    -e "MINIO_ROOT_USER=admin" -e "MINIO_ROOT_PASSWORD=12345678" \
    -v /usr/local/software/minio/data:/data -v /usr/local/software/minio/config:/root/.minio minio/minio server /data \
    --console-address ":9000" -address ":9090"


    5、安装nginx
    Dockerfile构建ngxinx
    FROM centos:7
    ADD nginx-1.19.10.tar.gz /usr/local
    COPY nginx_install.sh /usr/local
    RUN sh /usr/local/nginx_install.sh
    EXPOSE 80


    nginx_install.sh
    #!/bin/bash
    yum install -y gcc gcc-c++ make pcre pcre-devel zlib zlib-devel
    cd /usr/local/nginx-1.19.10
    ./configure --prefix=/usr/local/nginx && make && make install

    制作nginx镜像
    docker build -t mycentos:nginx .

    nginx 运行
    docker run -itd -p 80:80 mycentos:nginx  /usr/local/nginx/sbin/nginx -g "daemon off;"

    开机启动
    /etc/rc.d/rc.local

  • 相关阅读:
    html5期末大作业 基于HTML+CSS制作dr钻戒官网5个页面 企业网站制作
    1 如何入门TensorFlow
    web入门(1)---6.10
    基于51单片机的贪吃蛇游戏设计
    kong安装与配置
    PyTorch笔记 - Convolution卷积的原理 (1)
    c++类型转换和异常
    GitLab数据迁移后出现500错误
    [蔚来杯]Two Frogs
    Redis常用命令和Java操作Redis教程
  • 原文地址:https://blog.csdn.net/qq_41709084/article/details/137948011