Learning bits and pieces of container (b)

First, how to own a private mirror?

Method One: Use the commit command

1, assuming that a currently running httpd container, we can modify the html content directly container.

docker exec -it 2b66eedfc838 /bin/bash

id is the view out of the container with a docker ps: 2b66eedfc838

-it: no interference can enter the vessel

2, modify the index.html file

vim index.html

Note: If you do not have the vim command, the need to separately install the apt-get command.

3, the container is submitted modified private image.

docker commit 2b66eedfc838 my-httpd

4, to see if there is a mirror docker

Method 2: Dockerfile

1. Create a folder

mkdir myimage

2. Create Dockerfile

3、build Dockerfile

build docker .

4, to see if success

Second, the operation of the vessel which way?

1, foreground

如Docker run -it ubuntu /bin/bash

-i representative interactive

-t representatives terminal

2, running in the background

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

-d behalf detached, comes running in the background

 

Third, the container can control the use of resources?

The answer is yes, control by CGroups cpu, disk i / o, memory, etc., and the virtual machine control feel similar resources.

 

Fourth, network operation mechanism of the container is kind of how?

Container default network communication mechanism is bridge, how to understand?

Each start a container, the actual allocated a veth interface that interfaces with docker0 Bridge bridge communication. The card docker0 and the host is actually connected through the port mapping mode.

With docker network inspect bridge command, at a glance understanding. On the gateway corresponds docker0, the ip address in each container veth interface.

In fact, we can create a similar docker0 new gateway and the new container bridge to join the group, to form a new network segment. The host network segment can communicate, different network segments can not be exchanged.

I hope this article can help you.

更多内容实时更新,请访问公众号。    

 

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

Guess you like

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