zoukankan      html  css  js  c++  java
  • docker容器的使用

    一、基本使用

    1.1 下载docker

    yum install docker

     1.2 Docker镜像加速器

    curl -sSL https://get.daocloud.io/daotools/set_mirror.sh | sh -s http://95822026.m.daocloud.io

    1.3 查看镜像加速器

    cat /etc/docker/daemon.json
    {
        "registry-mirrors": ["http://95822026.m.daocloud.io"],
        "insecure-registries": []
    }  # 表示成功

    1.4 启动停止Docker

    systemctl status docker  #检查docker状态
    systemctl start  docker #启动docker
    systemctl stop    docker  #关闭docker

    1.5 下载hello-world镜像

    docker pull hello-world

     1.6 查看docker镜像

    docker images

    1.7 运行docker hello-world镜像

    docker run 镜像名/镜像id/镜像id的前3位

    1.8 搜索docker镜像(image)

    docker search centosdocker 
    search django(#搜索django镜像)

    1.10 运行一个交互式的centos容器

    docker run -it centos /bin/bas

    1.11 在后台运行一个容器,执行shell,每秒打印一个hellodocker,(此命令会返回一个容器id)

    docker run -d centos /bin/sh -c "while true;do echo hello centos; sleep 1;done"

    1.12 查看容器进程

    docker ps #用于查看正在运行的容器
    docker ps -a #用于查看所有运行过的容器

    1.13 查看容器运行的日志

    docker logs 容器id

    1.14 删除容器

    -先停止正在运行的容器
    docker stop 容器id
    docker rm 容器id
    -强制删除正在运行的容器
    docker rm -f 容器id
    #删除已有的docker镜像(image)
    docker rmi 镜像id

    Xshell连接云服务器  shh  云服务器ip

    查看CentOS版本Linux发行版 cat /etc/redhat-release

    内核版本查看 uname -r

    查看Docker版本 docker version

  • 相关阅读:
    Python格式化输出
    Python的变量和注释
    python解包
    顺序存储结构和链式存储结构优缺点
    CPU相关概念
    转载:关于STM32硬件I2C读写EEPROM代码实现原理的理解与总结
    ADC
    I2C协议学习笔记
    飞思卡尔K60时钟分析
    NXP_RTCESL库
  • 原文地址:https://www.cnblogs.com/aaronthon/p/9561106.html
Copyright © 2011-2022 走看看