zoukankan      html  css  js  c++  java
  • Docker镜像制作

      使用docker原始源为centos制作一个nginx镜像

      pull一个centos镜像

    docker pull centos
    

      运行进入容器

    docker run -it centos
    

      容器内安装wget

    yum -y install wget
    

      更换镜像源为阿里

    wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
    wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo

      安装nginx

    yum -y install nginx
    

      修改配置文件

     vi /etc/nginx/nginx.conf
    

      添加

    daemon off;
    

      检查语法正确

      启动(会卡住)

    nginx
    

      新启动一个终端提交

    docker commit -m "add nginx images" efcc90c8fe35  liuym/mynginx
    

      其中efcc90c8fe35为容器名(启动加--name参数最好),liuym/mynginx为镜像名

      查看(没有打tag号默认为latest)

      打tag号提交

    docker commit -m "add nginx images" efcc90c8fe35  liuym/mynginx:v1
    

      使用刚刚创建的镜像启动一个容器

     docker run -d --name my_nginx liuym/mynginx nginx
    

      PS:最后的nginx不是容器名,而是启动容器需要启动的命令

      docker官方镜像地址https://hub.docker.com/

      可以注册账号把自己做的镜像上传

      登录

    docker login https://hub.docker.com
    

      上传速度较慢

  • 相关阅读:
    树莓派_GPIO
    Python_PyQt_基本使用
    python_静态,组合,继承
    Linux_操作
    Pyqt5+eric6安装教程
    树莓派操作
    python_爬虫_requests
    HTML的基本操作
    python_pandas_numpy_json
    python_模块_sys_time_random_os
  • 原文地址:https://www.cnblogs.com/minseo/p/9108843.html
Copyright © 2011-2022 走看看