识字粗堪供赋役,不须辛苦慕公卿。这篇文章主要讲述docker基础用法相关的知识,希望能为你提供帮助。
- ??什么是docker???
- ?OCI& OCF?
- ??OCI???
- ??OCF???
- ??docker架构???
- ??docker镜像与镜像仓库???
- ??docker对象???
- ??安装及使用docker???
- ??docker安装???
- ??docker加速???
- ??docker常用操作???
- ??docker event state???
什么是docker?【docker基础用法】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)?
Open Container Format?
runC is a CLI tool for spawning and running containers according to the OCI specification?
- Containers are started as a child process of runC and can be embedded into various other systems without having to run a daemon?
- runC is built on libcontainer, the same container technology powering millions of Docker Engine installations?
docker架构?
docker镜像与镜像仓库?为什么镜像仓库名字是Registry而不是repository?在docker中仓库的名字是以应用的名称取名的。?
镜像是静态的,而容器是动态的,容器有其生命周期,镜像与容器的关系类似于程序与进程的关系。镜像类似于文件系统中的程序文件,而容器则类似于将一个程序运行起来的状态,也即进程。所以容器是可以删除的,容器被删除后其镜像是不会被删除的。?
docker对象?When you use docker, you are creating and using images, containers, networks, volumes, pluginns, and other objects.?
- IMAGES
- An image is a read-only template with instructions for creating a docker container.?
- 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.?
- 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.?
cd /etc/yum.repos.d/?
curl -o docker-ce.repo https://mirrors.tuna.tsinghua.edu.cn/docker-ce/linux/centos/docker-ce.repo?
sed -i s@https://download.docker.com@https://mirrors.tuna.tsinghua.edu.cn/docker-ce@g docker-ce.repo?
yum -y install docker-ce?
docker加速?
docker-ce的配置文件是/etc/docker/daemon.json,此文件默认不存在,需要我们手动创建并进行配置,而docker的加速就是通过配置此文件来实现的。?
docker的加速有多种方式:?
- docker cn?
- 中国科技大学加速器?
- 阿里云加速器(需要通过阿里云开发者平台注册帐号,免费使用个人私有的加速器)?
cat > /etc/docker/daemon.json < < EOF?
?
"registry-mirrors": ["https://docker.mirrors.ustc.edu.cn/"]?
?
EOF?
systemctl restart docker?
docker version?
docker info?
docker常用操作?
命令? | 功能? |
docker search? | Search the Docker Hub for images? |
docker pull? | Pull an image or a repository from a registry? |
docker images? | List images? |
docker create? | Create a new conntainer? |
docker start? | Start one or more stopped containers? |
docker run? | Run a command in a new container? |
docker attach? | Attach to a runninng container? |
docker ps? | List containers? |
docker logs? | Fetch the logs of a container? |
docker restart? | Restart a container? |
docker stop? | Stop one or more running containers? |
docker kill? | Kill one or more running containers? |
docker rm? | Remove onne or more containers? |
docker exec? | Run a command in a running container? |
docker info? | Display system-wide information? |
docker inspect? | Return low-level information on Docker objects? |
推荐阅读
- 可视化运维解决方案-构建数据大屏 华汇数据
- 虚链路
- $‘‘: command not found的解决方法
- ,直接导入Word文档(支持图片同步)!
- 分享|2022工业互联网厂商全景报告(附PDF)
- 如何利用Keras 深度学习库的进行回归
- 低代码是中小企业数字化转型的核心引擎
- OSPF虚链路配置
- RENIX_Python_如何实现调速——网络测试仪实操