docker Overview & installation of fancy

docker Overview:

What is the Docker?

  • Docker is a Linux container technology, an efficient, agile, and lightweight container solutions, and supports a variety of mainstream platform (PaaS) and local deployment. Docker is a cloud-based kai source Go language project implementation, was born in 2013, was originally the initiator is DotCloud company, later renamed DockerInc, after focusing on Docker related technologies and products kai hair. Docker project has now joined the Linux Foundation, follow Apache2.0kai source agreement, all kai dai source code associated maintenance are carried out on https://github.com/docker, the official website address is: HTTPS: //www.docker. com /, relevant documents can refer to, and now docker openstack with most popular cloud computing kai source project .

  • docker's Logo Design blue whale, dragging many containers. Conceived idea docker is to achieve "Build, ShipandRunAnyApp, Anywhere", that is, through the application package (Packaging), distribution (Distribution), deployment (Deployment), running (Runtime) lifecycle management, to application components "one package , run anywhere "purposes. Here's application component, either a Web application, a compiler environment, can also be a database service platform, operating system or even a cluster.
  • Based on a number of kai source technology on the Linux platform, Docker provides an efficient, agile and lightweight container program, and to support the deployment of the local environment and a variety of mainstream cloud platform. It can be said, Docker for the first time for the application of kai hair, operation and deployment provides a "one-stop" practical solutions.

docker Overview & installation of fancy

Why use docker?
1, Docker container benefits of virtualization

  • Docker Docker project sponsor and the company CTOSolomonHykes had thought, Docker in the right place at the right time to comply with the correct trend - how to build applications correctly.
  • Application developers create kai must be able to easily spread on the network in a cloud when dai, that is to say from the application must restrict the underlying physical hardware; at the same time must be "any time, any place" accessible. Therefore, kai developers need to create a new type of distributed applications way to quickly distribute and deploy, this is the biggest advantage Docker can offer.
  • Here is a simple example, suppose a user attempts based on the most common LAMP (Linux + Apache + MySQL + PHP) combination to build a website. According to the conventional practice, first need to install the Apache, MySQL, PHP and their respective run-dependent environment; after them separately configuration (including the appropriate user, configuration parameters, etc.); after a large number of operations is also required functional test, to see if working properly; if not normal, then debug trace, means more time dai price and uncontrollable risks. Imagine, if the number of applications increases, things will get more difficult to handle.
  • More alarming is that, once the required server migration (such as migrating from other Amazon cloud to cloud), often required for each application to re-deploy and debug. These trivial and uninteresting "manual labor", which greatly reduces the work efficiency. Its root is that these applications run directly on the underlying operating system, can not guarantee that the same application in a different environment consistent behavior.
  • The Docker provides a more clever way to package applications, decoupling applications and operating platforms through the container. When migration means that, just start the container needed on the new server can be, regardless of whether the old and new server is the same type of platform. This will undoubtedly save a lot of valuable time and reduce the risk of deployment problems.

2, Docker in kai development and operation and maintenance of advantages:

  • Faster delivery and deployment: Use Docker, kai developers can use to quickly build a mirror kai standard development environment; kai hair after completion, testing, and operation and maintenance personnel can be deployed directly dai code identical environment. As long as kai dai hair tested code, it can ensure seamless operation in a production environment. Docker can quickly create and delete containers, fast Diego dai, save a lot of kai development, testing, deployment time. Moreover, the entire process is visible throughout the team easier to understand the process of creation and job applications.
  • More efficient resource utilization: Run Docker containers no additional hypervisor (VirtualMachineManager, VMM, and Hypervisor) support, which is a kernel-level virtualization, can achieve higher performance, while additional demand for resources is low. Compared with the traditional way of virtual machines, to improve one to two orders of magnitude.
  • Easier migration and expansion: Docker containers can run on almost any platform, including physical machines, virtual machines, public cloud, private cloud, PCs, servers, etc., while supporting mainstream operating system release. This compatibility allows users to easily migrate applications between different platforms.
  • More simple update management: use Dockerfile, only a small configuration changes, you can update the past, a lot of work for dai. And all modifications are distributed and updated incrementally, enabling automated and efficient container management.

3, Docker virtual machine comparison:

  • As a virtual way a lightweight, Docker application running on a virtual machine with the traditional way has significant advantages compared to :
    Docker containers quickly, starting and stopping can be achieved at the second level, while the traditional approach requires several virtual machines minute.
    Docker containers little demand on system resources, you can run thousands of Docker containers on a host computer at the same time (on IBM servers has achieved a container instances running simultaneously on the order of 10K).
    Docker to facilitate a similar design philosophy of operation Git users to access, distribute and update applications mirroring, storage reuse, incremental updates.
    Docker created by Dockerfile support flexible automation and deployment mechanism, improve work efficiency, process standardization.
    In addition Docker containers wherein the application run, substantially without consuming additional system resources to ensure application performance while minimizing system kai pin. N traditional virtual machine run different applications will play N virtual machine (VM needs to be allocated for each exclusive memory, disk and other resources alone), while Docker just need to start the N isolation of "thin" container, and the application can be put into the container. Applications are available near native operating performance.
    Of course, in isolation, the traditional virtual machine is provided by way of a relatively closed isolation. But this does not mean that Docker is not safe, Docker variety protection technology on the Linux system to achieve strict isolation reliability, and can integrate many security tools. Starting from version 1.3.0 kai, Docker focus on improving security controls and security mechanisms mirrored container, which greatly improves the safety of the use of Docker. In the known large-scale applications, worth worrying about security risks has yet to appear.

Docker container technology and traditional characteristics of virtual machine technology comparison
docker Overview & installation of fancy

  • Docker approach to virtualization reason why there are many advantages, which is its own operating system virtualization technology design and implementation are inseparable.
    docker Overview & installation of fancy
  • The traditional way is to implement virtualization at the hardware level, the need for additional virtual machine management application and virtual machine operating system layer. Docker container is a virtualized, direct reuse of the local host operating system on the operating system level, and therefore more lightweight.

docker installation:

docker官网:https://www.docker.com/
docker官方文档:https://docs.docker.com/

  • Docker值得关注的特性:
    文件系统隔离:每个进程容器运行在一个完全独立的根文件系统里。
    资源隔离:系统资源,像CPU和内存等可以分配到不同的容器中,使用cgroup。网络隔离:每个进程容器运行在自己的网络空间,虚拟接口和IP地址。
    日志记录:Docker将会收集和记录每个进程容器的标准流(stdout/stderr/stdin),用于实时检索或批量检索。
    变更管理:容器文件系统的变更可以提交到新的映像中,并可重复使用以创建更多的容器。无需使用模板或手动配置。
    交互式shell:Docker可以分配一个虚拟终端并关联到任何容器的标准输入上

在安装docker之前,再说一点,docker现在有两个版本,一个叫做docker-EE企业版,收费的一个叫docker-CE社区版,免费版,其实两个版本并没有太大的偏差,不一样的是docker公司会提供后续的官方的技术支持等服务,对于我们来说,肯定用社区办的多,我们拿来学习社区办更是可以的。

安装docker内核版本要求:3.10及以上
如果是centos6版本,因为centos6默认的内核版本是2.6,想要安装docker,可以升级内核。

docker Overview & installation of fancy

docker Overview & installation of fancy

docker Overview & installation of fancy
docker Overview & installation of fancy
docker Overview & installation of fancy
docker Overview & installation of fancy
docker Overview & installation of fancy
docker Overview & installation of fancy

(1)官方安装:(我们是测试环境,所以安装的是ce)

[root@sqm-docker01 yum.repos.d]# pwd
/etc/yum.repos.d

[root@sqm-docker01 yum.repos.d]# vim dockerce.repo
[dockerce] //仓库类别
name=dockerce //仓库名称(说明)
baseurl=https://download.docker.com/linux/centos/7/x86_64/stable/ //URL访问路径
enabled=1 //启用此软件仓库
gpgcheck=0 //验证(检查)软件包的签名,0表示不检查,1表示检查

[root@sqm-docker01 yum.repos.d]# yum repolist
//查看已配置的yum仓库
docker Overview & installation of fancy

//安装docekr-ce
[root@sqm-docker01 yum.repos.d]# yum -y install docker-ce

(2)国内阿里yun源下载docker-ce:
(1)可以编写自定义yum仓库

阿里巴巴开源镜像站:https://opsx.alibaba.com/mirror
#找到docker-ce
docker Overview & installation of fancy

docker Overview & installation of fancy

URL:https://mirrors.aliyun.com/docker-ce/linux/centos/7/x86_64/

yum仓库内容:
docker Overview & installation of fancy

(2)或者直接下载阿里的repo源:
docker Overview & installation of fancy

将该文件使用wget工具下载到本地:

[root@sqm-docker01 yum.repos.d]# wget https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo

查看docker-ce的可用版本:

[root@sqm-docker01 yum.repos.d]# yum install -y docker-ce-18.09.0-3.el7 docker-ce-cli-18.09.0-3.el7 containerd.io-1.2.0-3.el7
docker Overview & installation of fancy

下载指定版本:
[root@sqm-docker01 yum.repos.d]# yum install -y docker-ce-18.09.0-3.el7 docker-ce-cli-18.09.0-3.el7 containerd.io-1.2.0-3.el7

  • 以上三个安装包分别是:
  • 安装社区版
  • 提供docker客户端
  • 提供运行环境

安装完启动docker,并加入开机自启:

[root@sqm-docker01 yum.repos.d]# systemctl start docker
[root@sqm-docker01 yum.repos.d]# systemctl enable docker

查看docker的运行进程:
docker Overview & installation of fancy

安装后的优化操作:

(1)Docker命令自动补全(最小化安装的系统需要安装,如果是安装的图形化则默认自带命令补全)

[root@docker01 ~]# yum -y install bash-completion
[root@docker01 ~]# curl -L https://raw.githubusercontent.com/docker/compose/1.24.1/contrib/completion/bash/docker-compose -o /etc/bash_completion.d/docker-compose
[root@docker01 ~]# source /etc/bash_completion.d/docker-compose

(2) docker accelerator configuration:
Road cloud accelerator URL: https://www.daocloud.io/
docker Overview & installation of fancy
After logging will have a rocket icon, click on it.

docker Overview & installation of fancy

docker Overview & installation of fancy

When prompted to restart the docker service:
[root @ sunqiuming-1 ~] # # systemctl daemon-reload to reload the daemon
[root @ sunqiuming-1 ~]

docker Overview & installation of fancy

在完成加速器的操作之后,我们会发现/etc/多了一个文件。

[root@sunqiuming-1 ~]# cat /etc/docker/daemon.json 
{"registry-mirrors": ["http://f1361db2.m.daocloud.io"]}

#### In other words, just that sentence, is to realize the file, add this URL, in fact, that this web site, you can also change the accelerator cloud is not just a road, there is a company that provides accelerator service, is the famous Ali cloud

Ali cloud official website: https://www.aliyun.com/
docker Overview & installation of fancy

docker Overview & installation of fancy

You can also change to this URL, then of course, if you change, you need to perform the reload command to reload at the configuration file.

[root@sunqiuming-1 ~]# systemctl daemon-reload 
[root@sunqiuming-1 ~]# systemctl restart docker

All content is more than the basic installation and optimization of the deployment docker.

-------- end of this article so far, thanks for reading --------

Guess you like

Origin blog.51cto.com/13972012/2445789