Docker entry and common commands

purpose:

  Docker entry

     Docker Profile

     Centos7 installation Docker

     Docker HelloWorld run analytical principle

     Ali cloud mirrored warehouse configuration

  Docker commonly used commands

     Docker basic commands

     Docker mirror commonly used commands

     Docker containers commonly used commands

 


 

Docker Profile

 

Docker is an open source application container engine, and follow Apache2.0 agreement based on open source Go language. Docker allows developers to package their applications and dependencies to a lightweight, portable containers in. A container is a packaged application services environment, it is a lightweight virtual machine , each container consists of a particular application and the necessary dependent libraries. The container is full use of the sandbox mechanism will not have any interface with each other, more important is the performance overhead is very low container. Docker divided after 17.03 version from CE (Community Edition: Community Edition) and EE (Enterprise Edition: Enterprise Edition), we use the community edition on it.

 

 

Docker 's official website: https://www.docker.com/

Docker application scenarios:

Web automation package and publish applications.

Automated testing and continuous integration, release.

Deployment and tuning the database or other back-office applications in a service-oriented environment.

Recompile or extend an existing OpenShift or Cloud Foundry platform to build their own PaaS environment.

Docker 's advantage

1 , a simplified procedure:

Docker allows developers to package their applications as well as a portable container to the dependencies, and then publish to any of the popular Linux machine, you can virtualize. Docker changed the way virtualization, enabling developers to put their results directly to the Docker for management. Convenient already Docker biggest advantage, that used to take days or even weeks with the task at Docker under treatment vessel, requiring only a few seconds to complete.

 

2 , avoid selecting phobia:

If you have a choice phobia, or experienced patients. Then you can use Docker package your tangle! For example Docker mirror; Docker mirror configuration and includes the operating environment, it Docker can deploy a variety of application examples simplified work. Such as Web applications, back-end applications, database applications, large data applications such as Hadoop cluster, message queues, etc., can be packaged into a single image deployment.

 

3 , save money:

一方面,云计算时代到来,使开发者不必为了追求效果而配置高额的硬件,Docker 改变了高性能必然高价格的思维定势。Docker 与云的结合,让云空间得到更充分的利用。不仅解决了硬件管理的问题,也改变了虚拟化的方式。

 

Docker的架构

Docker 使用客户端-服务器 (C/S) 架构模式,使用远程API来管理和创建Docker容器。

Docker 容器通过 Docker 镜像来创建。

容器与镜像的关系类似于面向对象编程中的对象与类。

Docker

面向对象

容器

对象

镜像

 

 

Docker 镜像(Images)

是用于创Docker 镜像建 Docker 容器的模板。

Docker 容器(Container)

容器是独立运行的一个或一组应用。

Docker 客户端(Client)

Docker 客户端通过命令行或者其他工具使用 Docker API (https://docs.docker.com/reference/api/docker_remote_api) Docker 的守护进程通信。

Docker 主机(Host)

一个者物理或虚拟的机器用于执行 Docker 守护进程和容器。

Docker 仓库(Registry)

Docker 仓库用来保存镜像,可以理解为代码控制中的代码仓库。

Docker Hub(https://hub.docker.com) 提供了庞大的镜像集合供使用。

 

Docker Machine

Docker Machine是一个简化Docker安装的命令行工具,通过一个简单的命令行即可在相应的平台上安装Docker,比如VirtualBoxDigital OceanMicrosoft Azure

 Docker 和虚拟机的区别

Docker是一种轻量级的虚拟化技术,比传统的虚拟机性能更好。
下图是虚拟机的体系结构:

 

server - 表示真实电脑。

Host OS - 真实电脑的操作系统,例如:Windows,Linux

Hypervisor - 虚拟机平台,模拟硬件,如VMWare,VirtualBox

Guest OS - 虚拟机平台上安装的操作系统,例如CentOS Linux

App - 虚拟机操作系统上的应用,例如nginx

下图是Docker的体系结构:

server - 表示真实电脑。

Host OS - 真实电脑的操作系统,例如:Windows,Linux

Docker Engine - 新一代虚拟化技术,不需要包含单独的操作系统。

App - 所有的应用程序现在都作为Docker容器运行。

这种体系结构的明显优势是,不需要为虚拟机操作系统提供硬件模拟。所有应用程序都作为Docker容器工作,性能更好。

 


 

Centos7安装Docker

Docker1.13版本之后采用时间线的方式作为版本号,分为社区版CE和企业版EE

社区版是免费提供给个人开发者和小型团体使用的,企业版会提供额外的收费服务,比如经过官方测试认证过的基础设施、容器、插件等。

社区版按照stableedge两种方式发布,每个季度更新stable版本,如17.0617.09;每个月份更新edge版本,如17.0917.10

我们平时用社区版就足够了。所以我们安装社区版;

我们主要参考:https://docs.docker.com/install/linux/docker-ce/centos/  来安装;

 

我们切换到root用户

1Docker 要求 CentOS 系统的内核版本高于 3.10 ,查看本页面的前提条件来验证你的CentOS 版本是否支持 Docker

通过 uname -r 命令查看你当前的内核版本

 $ uname -r

2、使用 root 权限登录 Centos。确保 yum 包更新到最新。

$ yum update

3、卸载旧版本(如果安装过旧版本的话)

$ yum remove docker  docker-common docker-selinux docker-engine

4 , required installation package, yum-util provide yum-config-manager function, the other two are devicemapper driven dependent

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

5 , disposed yum source

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

6 , install the latest version of Docker

$ yum install docker-ce docker-ce-cli containerd.io

 


 

Docker operating principle HelloWorld resolve

$ systemctl start docker

$ systemctl enable docker

 

$ docker version

8 , verification Docker

$ docker version

 

9 , Docker the HelloWorld test

$ docker run hello-world

 


 

Ali cloud mirrored warehouse configuration

 

 


 

Docker basic commands

 


Docker mirror commonly used commands

 


 

Docker containers commonly used commands


 

 

 

 

 

 

 

 

 

Guess you like

Origin www.cnblogs.com/huangting/p/11960196.html
Recommended