docker-01-容器简介&安装

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/lianjiaokeji/article/details/89278419

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)

猜你喜欢

转载自blog.csdn.net/lianjiaokeji/article/details/89278419