资讯详情

Docker自学笔记 (一)

Docker

https://docs.docker.com

https://hub.docker.com

docker基本组成

请添加图片描述

docker镜像是一个模板,可以通过这个模板创建容器服务

docker通过镜像创建容器技术独立运行一组或一组应用

启动、停止、删除

docker是个简易linux系统

仓库是放镜像的地方,

仓库分为公有仓库和私有仓库,docker hub 默认为国外仓库

安装

环境查看

[root@localhost /]# cat /etc/redhat-release CentOS Linux release 8.5.2111 [root@localhost /]# cat /etc/os-release NAME="CentOS Linux" VERSION="8" ID="centos" ID_LIKE="rhel fedora" VERSION_ID="8" PLATFORM_ID="platform:el8" PRETTY_NAME="CentOS Linux 8" ANSI_COLOR="0;31" CPE_NAME="cpe:/o:centos:centos:8" HOME_URL="https://centos.org/" BUG_REPORT_URL="https://bugs.centos.org/" CENTOS_MANTISBT_PROJECT="CentOS-8" CENTOS_MANTISBT_PROJECT_VERSION="8" [root@localhost /]# 

帮助文档

#1、卸载旧版本 yum remove docker \                   docker-client \                   docker-client-latest \                   docker-common \                   docker-latest \                   docker-latest-logrotate \                   docker-logrotate \                   docker-engine #2.需要安装的包                 sudo yum install -y yum-utils  #3、设置镜像仓库 sudo yum-config-manager \     --add-repo \     https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo   #阿里云推荐 \     https://download.docker.com/linux/centos/docker-ce.repo  #默认为国外 #4、安装docker相关  docker-ce 社区   ee 企业版  yum install docker-ce docker-ce-cli containerd.io  #5、启动daocker systemctl start docker  #6、使用docker version 检测安装 [root@localhost /]# docker version Client: Docker Engine - Community  Version:           20.10.14  API version:       1.41  Go version:        go1.16.15  Git commit:        a224086  Built:             Thu Mar 24 01:47:44 2022  OS/Arch:           linux/amd64  Context:           default  Experimental:      true  Server: Docker Engine - Community  Engine:   Version:          20.10.14   API version:      1.41 (minimum version 1.12)   Go version:       go1.16.15   Git commit:       87a90dc   Built:            Thu Mar 24 01:46:10 2022   OS/Arch:          linux/amd64   Experimental:     false  containerd:   Version:          1.5.11   GitCommit:        3df54a852345ae127d1fa3092b95168e4a88e2f8  runc:   Version:          1.0.3   GitCommit:        v1.0.3-0-gf46b6ba  docker-init:   Version:          0.19.0   GitCommit:        de40ad0 [root@localhost /]#  #7、运行 hello world  sudo docker run hello-world 

查看下载情况hello world 的image [root@localhost /]# docker images REPOSITORY               TAG       IMAGE ID       CREATED        SIZE docker/getting-started   latest    bd9a9f733898   7 weeks ago    28.8MB hello-world              latest    feb5d9fea6a5   6 months ago   13.3kB #9、卸载 卸载依赖 yum remove docker-ce docker-ce-cli containerd.io 删除资源 rm -rf /var/lib/docker  #默认工作路径 rm -rf /var/lib/containerd 

阿里云镜像加速

(3条消息) docker配置阿里云镜像加速器_易奕星空博客-CSDN博客_云加速器

#报错 可以重启系统

底层原理

Docker 是C/S结构系统,docker 主机上运行了保护过程。Socket访问客户端,Server端接收到Docker-Client回去执行命令。

1、Docker抽象层比虚拟机少。

2、docker 使用宿主机的核心。vm需要的guest os。

Docker常用命令

https://docs.docker.com/engine/reference/commandlin #文档

帮助命令

docker version #显示版本信息 docker info    #显示docker系统信息。包括镜像和容器的数量 docker 命令 --help  #帮助命令 

镜像命令

docker images [OPTIONS] [REPOSITORY[:TAG]]  ##查看当地所有主机上的镜像  [root@localhost /]# docker images REPOSITORY               TAG       IMAGE ID       CREATED        SIZE hello-world              latest    feb5d9fea6a5   6 months ago   13.3kB #解释 REPOSITORY 镜像的仓库来源 TAG        镜像的标签 MAGE ID    镜像的ID CREATED     创建镜像的时间    SIZE  镜像的大小  #可选项  Options:   -a, --all            #列出所有镜像   -q, --quiet           #只显示ID 

 docker search [OPTIONS] TERM  #搜索镜像  #可选项通过搜索过滤  --filter=STARS=3000 

标签: d260s01传感器

锐单商城拥有海量元器件数据手册IC替代型号,打造 电子元器件IC百科大全!

锐单商城 - 一站式电子元器件采购平台