1. Why did Docker appear?
One product: development
-
two sets of environments on line! Application environment, application configuration!
Development
-
operation and maintenance. Question: I can allow it on my computer! The version is updated, resulting in unavailable service! For operation and maintenance, the test is very
Big?
Environment configuration is very troublesome. Every machine has to deploy the environment
(
cluster
Redis
,
ES
,
Hadoop...)! It
takes a lot of effort.
Release a project
(code + (Redis MySQL))
, can the project bring the environment to install and package!
Before configuring an application environment on the server,
Redis MySQL Nignx
configuration was too troublesome and could not be cross-platform.
Development environment
Windows
, finally released to
Linux
!
Tradition: the development environment is set up
, operation and maintenance do it!
Now: The development, packaging and deployment is online, and a set of processes is complete!
Android process: C++
-apk-
release (application store) one, three use
apk,
one install and you can use it!
docker
process:
C ++
(environment)
-
packaged items Bands on the environment (Mirror)
- (Docker
Storage: store)
-----
Docker has
proposed solutions to the above problems!
2.
The idea of Docker
comes from the container! [Similar to a freighter (each container is a container)]
Isolation
: The
core idea of Docker! Pack the box! Each box is isolated from each other.
Docker
can use the server to the extreme through its isolation mechanism!
Essence: All technologies are due to some problems that we need to solve before we learn!
The history of Docker
In 2010
, a few young people established a company
dotcloud
in the United States to do some pass
cloud computing services!
Container technology related to
LXC
(
Linux Container
)! Linux Container is a kernel virtualization technology that can provide lightweight virtualization to isolate processes and resources. They named their technology (containerization technology) Docker
. When Docker was just born, it did not attract the attention of the industry!
dotCloud
, you can't live! Open source In 2013
,
Docker is
open source! More and more people are discovering
the advantages of
docker ! Fire.
Docker
will update a version every month! Nian 2014
4
Yue
9
Ri,
Docker1.0
released!
4.
Why is docker
so hot?
Very light! Before container technology came out, we all used virtual machine technology!
Virtual machine:
Install a VMware in the
window
, through this software we can virtualize one or more computers! bulky!
Virtual machine also belongs to virtualization technology,
Docker
container technology is also a kind of virtualization technology!
vm: linux centos
native mirror (one computer!) Isolation, need to open multiple virtual machines! A few
G
minutes
docker:
Isolation, the mirror is
very small, just run the mirror! Small!
Start in a few M
seconds!
Docker is
developed
based on the
Go
language! Open source project!
docker
official website:
https://www.docker.com/
Documentation:
https://docs.docker.com/
Docker
's documentation is super detailed!
Warehouse:
https://hub.docker.com/
V. Features of Docker
Compare
the difference between
Docker
and virtual machine technology:
Traditional virtual machine, virtualize a piece of hardware, run a complete operating system, and then install and run software on this system
The application in the container runs directly on the content of the host. The
container does not have its own kernel [all of the common host]
,
nor does it virtualize our hardware
, so
It's light
Each container is
isolated from each other, and each container has its own file system, which does not affect each other
Six. DevOps
(development, operation and maintenance)
Faster application delivery and deployment
- Tradition: a pair of help files, installer
- Docker : One-click operation of packaged image release test.
More convenient upgrade and expansion [the following operation is explained in detail]
- After using Docker , we deploy the application just like building blocks
- The project is packaged as a mirror, and server A is extended ! Server B
Simpler system operation and maintenance
After containerization, our development and test environments are highly consistent
More efficient use of computing resources
Docker
is kernel-level virtualization, which can run many container instances on a physical machine! Server performance can be squeezed
To the extreme.
Seven. The basic composition of Docker
![](https://img-blog.csdnimg.cn/20201019122028755.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3FxXzQ0MDY1MDg4,size_16,color_FFFFFF,t_70)
Mirror
image
( image)
:
The docker
image is like a target, and container services can be created through this target.
Tomcat
image
==>run==>
container
For the server),
multiple containers can be created through this image
(the final service operation or project operation is in the container).
Container
(container)
:
Docker
uses container technology to run one or a group of applications independently and is created by mirroring
.
Start, stop, delete, basic commands
At present, this container can be understood as a simple
Linux
system.
Warehouse
(repository)
:
The warehouse is where the mirrors are stored!
Warehouses are divided into public warehouses and private warehouses.
(
Very similar to
git)
Docker Hub
is foreign.
Alibaba Cloud
...
all have container servers
(
configuration image acceleration
!)
8. Install Docker Desktop [I use Windows here, I don’t need to install it in a virtual machine anyway, it’s not convenient to operate] I suggest you go to Docker Hub to register an account [Similar to git hub] Docker Hub is a mirror image warehouse
![](https://img-blog.csdnimg.cn/20201021154611365.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3FxXzQ0MDY1MDg4,size_16,color_FFFFFF,t_70)
Just like git operation
![](https://img-blog.csdnimg.cn/20201019132713478.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3FxXzQ0MDY1MDg4,size_16,color_FFFFFF,t_70)
Nine. The
underlying principle
How does
Docker work
?
Each can be seen as a small operating system environment [so there can also be virtual ports, which are similar to vpn] + code.
Docker
is a
Client-Server
structured system, and the
Docker
daemon runs on the host. Access
from the client through
Socket
ask! Docker-Server
will execute this command after receiving the
Docker-Client
instruction!
![](https://img-blog.csdnimg.cn/20201021160256549.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3FxXzQ0MDY1MDg4,size_16,color_FFFFFF,t_70)
Why
Docker
is
faster than
Vm
1
,
Docker has less than a virtual machine abstraction layer
. Since
docker
does not need a
Hypervisor [Virtual Machine Monitor] to
implement hardware resource virtualization
,
the programs running on the docker container
directly use the hardware resources of the actual physical machine through the kernel of the physical host
. Therefore
, docker will have obvious advantages in efficiency in terms of
CPU
and memory utilization
.
2
,
Docker host using the kernel, without the need for Guest OS.
GuestOS: the system ( OS ) in the VM (virtual machine ) ;
HostOS: The system in the physical machine ( OS )
![](https://img-blog.csdnimg.cn/20201021160637958.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3FxXzQ0MDY1MDg4,size_16,color_FFFFFF,t_70)
Therefore
,
when
creating
a new container, docker
does not need to reload an operating system kernel like a virtual machine. However, it is a time-consuming and resource-consuming process to avoid booting and loading the operating system kernel. When creating
a new
virtual machine, the virtual machine software needs to load GuestOS . This new creation process takes minutes.
Since
docker directly uses the host's operating system
,
this complicated process is omitted, so it
only takes a few seconds to create a new docker
container.