zoukankan      html  css  js  c++  java
  • docker 制作镜像并上传

    登录:
        docker login hub.xesv5.com
    下载镜像
        docker pull docker.io/suin/php533
        docker pull docker.io/gizystems/php53-fpm-server
        
    使用镜像创建容器
        docker  run  -dit  --name=容器名  镜像id  /bin/bash 
            
        docker run -dit  --name=tanxiao 4fac616af981 /bin/bash 
        docker run -dit  -v /root/php5.3:/usr/local/php5.3 --name=tanxiao bdc1c764dfdc /bin/bash 
        docker run -dit -v /root/lib64:/usr/lib64 -v /root/php5.3:/usr/local/php5.3 --name=tanxiao 31ffa49234e5 /bin/sh
    
        
        docker命令参数:
            -d :后台运行容器,并且返回容器ID
            -c :后面跟着待完成的命令
            docker run -d centos:latest /bin/bash -c “while true;do echo hello ;sleep 1;done”
    
    进入容器
        格式:docker  exec  -it  容器名  /bin/bash 
    
    将容器制作成镜像
        commit 这种制作镜像 -v 路径没有做到镜像里面
        docker  commit  -m  '镜像描述'  -a  '制作者'  容器名  镜像名
        docker commit -m  '摊销php53'  tanxiao1 tanxiao:v1.1.1
    利用dockerfile制作镜像
        提前把要挂载的php拷贝到制作目录下面
        mkdir /docker-build
        cd /docker-build
        touch Dockerfile
        
        FROM docker.io/act4peri/centos75-python371
        MAINTAINER <lichuan1@tanl.com>
        ADD php5.3 /usr/local/
        ADD lib64 /usr/lib64
        RUN yum -y install nginx
    docker build -t tanxiao-v1-m:tanxiaophp53 ./
    docker build -t hub.xesv5.com/jituan-xinxi-audit/tanxiao-v1-m:tanxiaophp53 ./
    
    将制作好的镜像打成 tar 包
        docker  save  -o  tar包的名字  镜像名
        docker  load  <  tar 包所在路径
        
    打标签
        docker tag local-image:tagname new-repo:tagname
        docker tag tanxiao:v1.1.1 hub.xesv5.com/lichuan1/tanxiao:tanxiaophp53
    
    随送新仓库
        docker push new-repo:tagname
        docker push hub.xesv5.com/jituan-xinxi-audit/tanxiao-v1-m:tanxiaophp53
        docker push hub.xesv5.com/lichuan1/tanxiao:tanxiaophp53
        
    https://blog.csdn.net/qq_41729148/article/details/85221854

    supervisor配置文件

    [unix_http_server]
    file=/dev/shm/supervisor.sock   ; (the path to the socket file)
    
    [supervisord]
    logfile=/tmp/supervisord.log ; (main log file;default $CWD/supervisord.log)
    logfile_maxbytes=50MB        ; (max main logfile bytes b4 rotation;default 50MB)
    logfile_backups=10           ; (num of main logfile rotation backups;default 10)
    loglevel=info                ; (log level;default info; others: debug,warn,trace)
    pidfile=/tmp/supervisord.pid ; (supervisord pidfile;default supervisord.pid)
    nodaemon=false               ; (start in foreground if true;default false)
    minfds=102400                  ; (min. avail startup file descriptors;default 1024)
    minprocs=200                 ; (min. avail process descriptors;default 200)
    user=root                    ;
    
    ; the below section must remain in the config file for RPC
    ; (supervisorctl/web interface) to work, additional interfaces may be
    ; added by defining them in separate rpcinterface: sections
    [rpcinterface:supervisor]
    supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface
    
    [supervisorctl]
    serverurl=unix:///dev/shm/supervisor.sock ; use a unix:// URL  for a unix socket
    
    [program:php-fpm]
    command = /usr/local/php5.3/sbin/php-fpm -R --nodaemonize 
    autostart=true
    autorestart=true
    priority=5
    stdout_events_enabled=true
    stderr_events_enabled=true
    stdout_logfile=/home/logs/xeslog/php-fpm_out.log
    stdout_logfile_maxbytes=0
    stderr_logfile=/home/logs/xeslog/php-fpm_error.log
    stderr_logfile_maxbytes=0
    stopsignal=QUIT
    
    [program:nginx]
    command=/usr/local/openresty/nginx/sbin/nginx -g "daemon off;"
    autostart=true
    autorestart=true
    priority=10
    stdout_events_enabled=true
    stderr_events_enabled=true
    stdout_logfile=/home/logs/xeslog/nginx_out.log
    stdout_logfile_maxbytes=0
    stderr_logfile=/home/logs/xeslog/nginx_error.log
    stderr_logfile_maxbytes=0
    stopsignal=QUIT
    
    [include]
    files = /etc/supervisor/conf.d/*.conf

    容器dockerfile

    FROM a'a.a'a.caaom/library/php:7.2-oci8-nginx-soap-2
    ## FROM行由前端生成,请不要改动
    ADD ./git-resource /home/wwwroot/mdm.zhiyinlou.com
    ADD ./config/default.conf /etc/nginx/conf.d/default.conf
    ADD ./config/.env /home/wwwroot/mdm.zhiyinlou.com/.env
    
    WORKDIR /home/wwwroot/mdm.zhiyinlou.com
    
    RUN echo "date.timezone=Asia/Shanghai" > $PHP_INI_DIR/conf.d/timezone.ini
    
    # Start supervisord and services
    CMD ["/usr/bin/supervisord", "-n", "-c", "/etc/supervisord.conf"]
  • 相关阅读:
    Android批量插入数据库提升速度(9.9)
    Android中database所在文件夹路径(9.6)
    Eclipse更改默认工作环境编码为UTF-8(9.6)
    Android下Sqlite的使用(9.7)
    Android下ListView的分页(9.6)
    【转】Tarjan算法 资料合集
    【转】BYV--有向图强连通分量的Tarjan算法
    Codeforces Round #403---C题(DFS,树)
    codeforces#403—B题(二分,三分)
    【转】毛虫算法——尺取法
  • 原文地址:https://www.cnblogs.com/litzhiai/p/15604190.html
Copyright © 2011-2022 走看看