Learning bits and pieces of container (a)

Micro Services and containers can be said to rely on each other in Internet companies (such as Jingdong electricity supplier), container basically become resistant to peak weapon 11.11.

First, how the safety of the vessel? What version supports container?

Linux container depends on the NameSpace, CGroups features, is a logical isolation, security is certainly not how the virtual machine is isolated from the underlying operating system to good.

64-bit version of the Linux kernel higher than the 3.10 support vessel.

root@Master:~# uname -r

4.2.0-27-generic

Second, compared to a virtual machine container What are the advantages?

1, a small volume

docker like centos image size, usually only 200M.

Like operating system image following ubuntu, only 69.9M, really a little unexpected.

docker.io/ubuntu       69.9 MB

2, ultra-fast start

1s completed within the general start. However, if the container has not been called, it is not actually loaded into memory, but add a read-write layer already on the mirror. The virtual machine usually takes about one minute to start.

3, the number of multi-support

Generally a single physical machine can run containers holding thousands of online and virtual machines generally only supports dozens.

Third, container and mirrored What is the relationship?

If there is object-oriented programming often, image class is a class, an instance of the container instance. If a "dog" image, and a live "Shar-Pei" is the container.

Fourth, how container external communications?

After running a container, we find that the container will start a new network interface docker0 on the computer, and assign the interface for a network address.

docker0 and the computer will be connected through the bridging / routing.

Below, the actual computer network interface enp0s3, ip network 10.0.2.15/24; docker0 the network address is 172.16.0.1/16.

Fifth, how to start a simple apache container?

1, from the docker hub public Internet library to download from a mirror

docker pull httpd

2, boot image

docker run -d -p 8088:80 docker.io/httpd

-d representatives running in the background

-p port representatives, external network port is 8088, 80 is the internal port docker0

3, ie open test.

I hope this article can help you.

More real-time updates, visit public number.    

 

点击这里,获取最高¥1888阿里云产品通用代金券

Guess you like

Origin blog.csdn.net/qq_29718979/article/details/92015969