-allocates a pseudo-input terminal to the container, usually with-I simultaneously;--name= "nginx-lb" specifies a name for the container;--dns 8.8.8.8 Specifies the DNS server used by the container, default and host consistent;--dns-search example.com Specifies the container DNS search domain name, default and host consistent;-H "Mars" specifies the hostname of the container;-E Username= "Ritchie" setting environment variables;--env-file=[] read from the specified file into the environment varia
Docker network modes and docker network Modes
When using docker run to create a Docker container, you can use the -- net option to specify the container network mode. Docker has the following four network modes:
· Host mode, specified using -- net = host.
· Container mode, w
to access the server side of the current machine. The following shows how to access other Docker server ports.
First set of ip:192.168.12.3
Second set of ip:192.168.12.4
Demo with a second server with Docker installed. To differentiate, set the label differently.
To modify the daemon (Server) default startup configuration:
The default is:-H fd://, can be modified to:-H tcp://0.0.0.0:2375-h unix:///var/run/
options:
host1:docker_opts= "-b=br0–fixed-cidr= ' 10.211.55.64/26 '"
host2:docker_opts= "-b=br1–fixed-cidr= ' 10.211.55.128/26 '" Here, the bridge name used to specify the container connection
–fixed-cidr used to qualify the range of IP addresses assigned to a container
Save file and restart Docker service
$ sudo service docker restart Below, you can verify that:
1. Start a container on the two host,
see on the second machine Docker0 IP is the 172.17.0.2/16,docker container that obtains IP from Docker0 's network, and on the second machine, the Docker container's IP range is limited to 172.17.2.1/24 network segment.
Test host1
View IP to ensure connectivity to Host2 DOCKER0IP
root@controller:~# ifconfig docker0
docker0 Link encap:ethernet hwaddr 00:0c:2
How Docker layouts PHP development environment, Docker layout PHP development
Environment deployment has always been a big problem, whether it is a development environment or a production environment, but Docker packages the development environment and production environment in a lightweight manner, providing a consistent environment. Greatly improved developmen
is that when you run a specific mirror, you can specify your container DNS server.When you have a consul run (or other DNS server) you can add it to your Docker daemon just like this:
Docker run-d--dns $IP _consul--dns-search service.consul
dockerrun-d--dns $IP _consul--dns-searchservice.consul
Now we can solve the IP address of all containers registered with Consul name, for example in our environmen
, Docker container to Docker0 as a virtual bridge or call routing, all Docker containers are connected to this Docker0, by Docker0 to do routing, by the Docker0 Bridge to assign IP list the main Machine Bridge: yum-y install Bridge-utils/brctl Show uses a specific range of IPs: need to install bridge-utils ensure: 1.
Docker process is stopped:
running.
5. Docker inspect output results of the analytical tool: JQ
To filter the output of the Docker inspect, in general, with the grep command, you need to do this:
Oh! Looks very complex, with JQ bar, professional analytical docker inspect output results, with more readability, easy to use:
One of the first '. ' Represents all
Docker-2 learn more about docker, docker-2dockerDockerBasic concepts of images, containers, and warehousesImages
A Docker image is a read-only template.For example, an image can contain a complete CentOS operating system environment where only httpd or other applications are installed.
Images can be used to create
that the container can be run the next time you save the latest state.
# Save changes to the container; -A,--author= "" author; -M,--message= "" Commit message
$docker commit ID New_image_name
Note:image equivalent to the class, container equivalent to the instance, but you can dynamically install new software to the instance, and then the container with a commit command to solidify into an image.
6. Operations on Containers (RM, stop, start, Ki
-rw-r--R--1 root root 140 Feb 20 2014. Profile Drwxr-xr-x 7 root root 4096 Aug 07:49 bespoke-fx
Now we exit the container.
We do it again.
1 2 3
sudo docker run-i-T Ubuntu/bin/bash cd/root Ls-al
The clone's Bespoke-fx directory disappears, the container's lifecycle ends, and the resources in its container disappear. Using the Docker hub Central mirrored warehouse
First need to register an account, there are
underlying associated data
Boot container can see the container layer is also saved in the/var/lib/docker/overlay/directory, into the container layer of the directory can see the file lower-id,merged,upper,work
Where Lower-id contains the top-level ID of the mirror (top-level image is saved in Lowerdir)
The container layer is stored in the upper directory, and the data modified during the run is stored in that directory; The merged directory is th
sudoservice docker restart
# After restarting, try it and whether it takes effect?
1
docker version
#若还未生效, the system restarts, it takes effect?
1
sudoreboot
Docker Common Commands# download an Ubuntu image?
1
sudodocker pull ubuntu
# use Ubuntu to ru
Docker InspectEstimated reading Time:2 minutes
Description
Return low-level information on Docker objects Usage
Docker inspect [OPTIONS] name|id [name|id ...]
Options
Name, Shorthand
Default
Description
--format, F
Format the output using the given go template
--size, S
False
Display Total Fil
virtualization tools, such as VPS that have long been heard of?From a technical point of view, the underlying principle is similar. Look at the picture.
Docker, like other OS virtualization technologies, has roughly the same technical implementation. The key to see who can drive the ecosystem, to win the support of other manufacturers. At the same time, Docker's layered file system implementation is also a particularly fascinating place. Here is the
windows will be displayed simultaneously. When a window is blocked, other Windows cannot be operated.
Docker 1.3 has provided the exec Method for entering the container in another one.Docker exec-ti CONTAINER_ID/bin/bash
Delete container
Docker rm [options] container [container...] -f: -- force = false force terminate and delete a running container-l: -- link =
[Docker discussion]docker not everything, and you don't have to deploy everything on Docker.When I read an article "running and upgrading a MySQL server in a docker container": https://intercityup.com/blog/running-upgrading-mysql-server-docker/After that, I don't think Docker
1. Docker command lineDocker is an interactive tutorial designed to help users master the use of Docker command lines in order to get a quick overview of Docker. But thanks to the rapid development of Docker technology, this interactive tutorial has been unable to meet the actual needs of
http://blog.51cto.com/mysky0708/2298049To undertake the above, in the production of how to secure the link Docker host it? We use the TLS secret key approach.Steps:First Part: First generate the secret key on the Docker host and save it to the designated place;Part II: On the Management node (portainer), specify the above secret key and add the node.Specific impl
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.