dorcker的基础用法

dorcker简介

docker是容器技术的一个前端工具,容器是内核的一项技术,docker只是把这一项技术的使用得以简化,使之普及而已。(dorcker是管理容器的工具)

docker中的容器:

lxc --> libcontainer --> runC

OCI&OCF

OCI

Open Container-initiative(开放容器计划)

  • 由Linux基金会主导于2015年6月创立
  • 旨在围绕容器格式和运行时制定一个开放的工业化标准
  • contains two specifications(包含两个规格)
    • the Runtime Specification(runtime-spec)(运行时规范)
    • the Image Specification(image-spec)(图像规范)
OCF

Open Container Format(开放容器格式)

runC is a CLI tool for spawning and running containers according to the OCI specification(runC 是一个 CLI 工具,用于根据 OCI 规范生成和运行容器)

  • Containers are started as a child process of runC and can be embedded into various other systems without having to run a daemon(容器作为 runC 的子进程启动,可以嵌入到各种其他系统中,而无需运行守护程序)
  • runC is built on libcontainer, the same container technology powering millions of Docker Engine installations(runC 建立在 libcontainer 之上,libcontainer 是支持数百万个 Docker 引擎安装的相同容器技术)

docker提供了一个专门容纳容器镜像的站点:https://hub.docker.com

docker架构

在这里插入图片描述

客户端和主机在同一台主机上客户机执行命令,向主机发送请求寻找服务,查找本地有无此服务,有的话就启动,没有去镜像中下载启动。
docker-ee 付费
docker-ce 开源

docker镜像与镜像仓库

为什么镜像仓库名字是Registry而不是repository?在docker中仓库的名字是以应用的名称取名的。
在这里插入图片描述

镜像是静态的,而容器是动态的,容器有其生命周期,镜像与容器的关系类似于程序与进程的关系。镜像类似于文件系统中的程序文件,而容器则类似于将一个程序运行起来的状态,也即进程。所以容器是可以删除的,容器被删除后其镜像是不会被删除的。
docker对象

docker对象

When you use docker, you are creating and using images, containers, networks, volumes, pluginns, and other objects.(使用 Docker 时,您正在创建和使用映像、容器、网络、卷、插件和其他对象。)

  • IMAGES(图像)
    • An image is a read-only template with instructions for creating a docker container.(映像是一个只读模板,其中包含有关创建 docker 容器的说明。)
    • Often, an image is based on another image, with some additional customization.(通常,一个映像基于另一个映像,并具有一些额外的自定义。)
    • You might create your own images or you might only use those created by others and published in a registry.(可以创建自己的映像,也可以只使用其他人创建并在注册表中发布的映像。)
  • CONTAINERS(器皿)
    • A conntainer is a runnable instance of an image.(连接器是图像的可运行实例)
    • You can create, run, stop, move, or delete a container using the docker API or CLI.(可以使用 Docker API 或 CLI 创建、运行、停止、移动或删除容器。)
    • You can connect a container to one or more networks, attach storage to it, or even create a new image based on its current state.(可以将容器连接到一个或多个网络,将存储附加到该网络,甚至可以根据其当前状态创建新映像。)

安装及使用docker

docker安装
[root@localhost ~]# cd /etc/yum.repos.d/
[root@localhost yum.repos.d]# wget https://mirrors.tuna.tsinghua.edu.cn/docker-ce/linux/centos/docker-ce.repo
[root@localhost yum.repos.d]# sed -i 's@https
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值