In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly explains "how to install Docker". The content in the article is simple and clear, easy to learn and understand. Please follow the editor's train of thought to study and learn "how to install Docker".
I. brief introduction
1. Using Docker: developers only need to care about the applications running in the container, while operators only need to care about how to manage the container. The purpose of Docker design is to enhance the consistency between the development environment in which developers write code and the production environment in which applications are to be deployed, so as to reduce the risk that "everything is normal during development, it must be a problem of operation and maintenance".
2.Docker core components:
Docker client and server, also known as Docker engine
Docker Mirror
Registry
Docker container
Second, install Docker
III. Introduction to Docker
1. You can use docker attach to reattach to a container session
two。 Use docker top to view process information in the container
3. Use docker stats to view container statistics
4.-restart. You can specify the automatic restart and restart times of the container.
Use Docker images and repositories
a. What is a Docker Mirror
1. The bottom end is the boot file system: the second layer of bootfs; is the root file system rootfs, the operating system
2.Docker uses joint load (union mount) technology to load more read-only file systems on the root file system layer. Such file systems are called mirrors. One image can be placed on top of another image, the image below is called the parent image (parent image), and the bottom image is called the base image.
3. When an image starts the container, Docker loads a read-write file system at the top of the image, and the program we want to run in Docker is executed in this read-write layer.
4. Copy while writing (copy on write). Each read-only mirror layer is read-only and will never change in the future. When creating a new container, Docker builds a mirror stack and adds a read-write layer at the top of the stack. This read-write layer, plus the mirror layer below it and some configuration data, forms a container.
b. List Mirror
1.docker images
two。 User warehouse consists of user name and warehouse name: username/repository
3. The top-level warehouse is managed by Docker and predetermined vendors that can provide high-quality basic images, including only the warehouse name.
c. Pull the image
1.docker pull
d. Find Mirror
1.docker search
e. Build an image
1. Two methods
Docker commit (not recommended)
Docker build and Dockerfile files
two。 It is recommended that you set the command to be executed in an array
The 3.CMD instruction is overwritten by the instruction on the command line
4.ENTRYPOINT runs the command specified in the ENTRYPOINT instruction by taking the instruction on the command line or the CMD instruction as parameters
f. Delete Mirror
1.docker rmi
5. Use Docker in testing
a. Use Docker to test static websites
1. Value of the volume:
Want to develop and test the code at the same time
The code changes frequently and I don't want to reconstruct the image during the development process.
Want to share code among multiple containers
b. Build and test Web applications using Docker
1.Docker Networking:
You can connect containers to containers on different hosts
A connected container that goes home through Docker Networking can stop, start, or restart the container without updating the connection.
You don't have to create a container before connecting to it.
The 2.docker network command creates a bridge network, such as docker network create app, and creates a bridge network called app; docker network ls, view; docker network rm, delete
3.run container-net=app, which specifies that the container runs on the app network; docker network inspect app, view the information of the app network
The 4.docker network connect command adds the running container to the existing network; the docker network disconnect command disconnects a container from the specified network
5.run container-link, creating a customer-service link between the two containers, such as docker run-d-link reds:db... Container name: alias of the link is required; container links can only work in the same Docker host
Docker Networking is recommended for 6.Docker1.9 and later, and Docker link is recommended for previous versions.
C.Docker for continuous integration
d. Multi-configuration Jenkins
e. Other options
1.Drone 、 Shippable
Use Docker to build services
1. A volume is a directory specifically specified in one or more containers that bypasses the federated file system, providing useful features for persistent and shared data:
Volumes can be shared and reused between containers
It is not necessary to run the corresponding container when sharing volumes
Changes to the volume will be reflected directly on the volume.
Changes to the volume are not included when updating the mirror
Volumes will exist until no container uses them
two。 Flag-volumes-from adds all volumes in the specified container to the newly created container
VII. Docker allocation and service discovery
1. Orchestration roughly describes the process of automating the configuration, collaboration, and management of services. In Docker, orchestration describes a set of practices that manage applications running in multiple Docker containers that may run on multiple host machines
A.Docker Compose
1.Docker Compose uses a YAML file to define a set of containers to start, as well as the properties of the container runtime. Docker Compose calls these containers "services," and containers interact with other containers through certain methods and specifying some runtime properties.
B.Consul, Service Discovery and Docker
1. Service discovery allows a component to automatically find each other when it wants to interact with other components
2.Consul is a special data store that uses consistent algorithms.
C.Docker Swarm
1.Swarm manages a group of Docker hosts as a virtual Docker host
8. Use Docker API
1. Three kinds of API:Registry API, Docker Hub API and Docker Remote API
2.Docker Remote API, provided by the Docker daemon, can be bound to the network interface (local test: echo-e "GET / info HTTP/1.0\ r\ n" | sudo nc-U / var/run/docker.sock)
3. You can use openssl to authenticate Docker Remote API
Thank you for your reading, the above is the content of "how to install Docker", after the study of this article, I believe you have a deeper understanding of how to install Docker, and the specific use needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.