美文网首页程序员
docker容器简介&安装

docker容器简介&安装

作者: 162f127842fc | 来源:发表于2019-04-13 10:04 被阅读3次

    docker容器简介&安装

    官方:
    www.docker.com
    国内镜像:
    www.docker-cn.com
    Docker版本:DockerCE(社区版) DockerEE(企业版)

    安装docker

    系统支持:

    OverlayFS: If selinux is enabled, the overlay2 storage driver is supported on CentOS 7.4 or higher.
    If selinux is disabled, overlay2 is supported on CentOS 7.2 or higher with kernel version 3.10.0-693 and higher.

    官方文档:

    https://docs.docker.com/install/linux/docker-ce/centos/
    

    安装yum工具组件

    sudo yum install -y yum-utils device-mapper-persistent-data lvm2
    

    添加到仓库里面

    sudo yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
    

    查看所有的ce版本

    yum list docker-ce --showduplicates | sort -r
    

    安装指定版本:

    sudo yum install docker-ce-<VERSION_STRING> docker-ce-cli-<VERSION_STRING> containerd.io
    

    安装最新:docker-ce版本

    sudo yum install docker-ce
    

    启动:docker

    sudo systemctl start docker
    

    运行hello-world镜像

    sudo docker run hello-world
    

    阿里镜像加速器,登录阿里云后台

    实例-》容器镜像服务-》镜像加速器

    配置加速器

    vim /etc/docker/daemon.json
    

    配置参数

    {
    "registry-mirrors": ["https://XXX.mirror.aliyuncs.com"]
    }
    

    常用命令:

    #查看docker详细信息
    docker info
    #docker相关帮助文档
    docker --help
    #查看镜像
    docker images --no-trunc
    

    搜索镜像:

    docker search tomcat
    docker search -s 30 tomcat
    

    下载nginx镜像

    docker pull nginx
    

    查看镜像

    docker images
    

    删除镜像

    docker rmi hello-world:latest
    强制删除
    docker rmi -f hello-world:latest
    删除所有
    docker rmi $(docker images)
    
    强删除所有
    docker rmi -f $(docker images -q)
    

    相关文章

      网友评论

        本文标题:docker容器简介&安装

        本文链接:https://www.haomeiwen.com/subject/zqqlwqtx.html