The role of docker is: 1. Better utilization of resources; 2. Customization for microservices; 3. Convenient transplantation between cloud service providers; 4. Convenient use of APIs; 5. Convenient technology Innovation.
The role of docker is:
1. Make better use of resources
The granularity of a virtual machine is a "virtual machine", while the granularity of Docker is a "restricted application". In comparison, Docker takes up less memory and is more lightweight.
For me, this is an advantage of Docker: because I often run multiple Docker applications on my computer, using Docker is simpler and more convenient than using a virtual machine, with finer granularity and continuous tracking. Container status.
2. Customize for microservices
If you have been paying attention to technology news, then you should have heard of the concept of "Microservices". Docker can be combined well with microservices. Conceptually, a microservice is a container that provides part of a complete set of application functionality, and Docker can serve as a microservice container during development, testing, and deployment. Even production environments can deploy microservices in Docker.
3. Porting between cloud service providers
Most cloud hosting providers already fully support Docker. For developers, this means that you can easily switch cloud service providers. Of course, you can also easily move your local development environment to a cloud host. There is no need to configure the running environment locally and configure it on the cloud host. Also configure the running environment once. Comprehensive deployment of Docker (Docker here and Docker there) as a standard operating environment can greatly reduce the workload and generate bugs when the application is online.
4. API side
API is the glue between applications. A qualified developer must have used REST APIs provided by others, or developed REST by himself. API. It should be pointed out that whether it is the client or the API provider, before development, a set of public API interfaces need to be defined and documented before coding. If the server and client are jointly developed, the server will usually first implement an API interface that can return a fixed string, and then slowly implement the API functions in future development.
Although some people may think that Docker has been abused here, and you can use files like sample.json to implement virtual APIs, there is an example below that can better solve the API problem when developing front-end and back-end separation.
To better explain what I mean, let me give you an example: JSON Server, a REST API for providing JSON data. Anyone who has used this container will know that since there is such an easy-to-use Docker JSON Server, we have no reason not to use Docker.
5. Technical innovation
This shouldn’t be considered a use case, but I’ll write it down anyway. Docker is developing rapidly and the tools are constantly being updated. No one can predict what Docker will look like in the future. The more you use Docker in complex systems, the more likely you are to discover gaps in technology and the direction of future technology development. We are still in the development stage of Docker, and any tool you create using Docker is likely to become a hot topic in the community. This is Docker’s opportunity, and it’s your own opportunity.
Recommended related tutorials: docker tutorial
The above is the detailed content of What does docker do?. For more information, please follow other related articles on the PHP Chinese website!

Using Docker on Linux can improve development efficiency and simplify application deployment. 1) Pull Ubuntu image: dockerpullubuntu. 2) Run Ubuntu container: dockerrun-itubuntu/bin/bash. 3) Create Dockerfile containing nginx: FROMubuntu;RUNapt-getupdate&&apt-getinstall-ynginx;EXPOSE80. 4) Build the image: dockerbuild-tmy-nginx. 5) Run container: dockerrun-d-p8080:80

Docker simplifies application deployment and management on Linux. 1) Docker is a containerized platform that packages applications and their dependencies into lightweight and portable containers. 2) On Linux, Docker uses cgroups and namespaces to implement container isolation and resource management. 3) Basic usages include pulling images and running containers. Advanced usages such as DockerCompose can define multi-container applications. 4) Debug commonly used dockerlogs and dockerexec commands. 5) Performance optimization can reduce the image size through multi-stage construction, and keeping the Dockerfile simple is the best practice.

Docker is a Linux container technology-based tool used to package, distribute and run applications to improve application portability and scalability. 1) Dockerbuild and dockerrun commands can be used to build and run Docker containers. 2) DockerCompose is used to define and run multi-container Docker applications to simplify microservice management. 3) Using multi-stage construction can optimize the image size and improve the application startup speed. 4) Viewing container logs is an effective way to debug container problems.

Docker container startup steps: Pull the container image: Run "docker pull [mirror name]". Create a container: Use "docker create [options] [mirror name] [commands and parameters]". Start the container: Execute "docker start [Container name or ID]". Check container status: Verify that the container is running with "docker ps".

The methods to view Docker logs include: using the docker logs command, for example: docker logs CONTAINER_NAME Use the docker exec command to run /bin/sh and view the log file, for example: docker exec -it CONTAINER_NAME /bin/sh ; cat /var/log/CONTAINER_NAME.log Use the docker-compose logs command of Docker Compose, for example: docker-compose -f docker-com

You can query the Docker container name by following the steps: List all containers (docker ps). Filter the container list (using the grep command). Gets the container name (located in the "NAMES" column).

Create a container in Docker: 1. Pull the image: docker pull [mirror name] 2. Create a container: docker run [Options] [mirror name] [Command] 3. Start the container: docker start [Container name]

Four ways to exit Docker container: Use Ctrl D in the container terminal Enter exit command in the container terminal Use docker stop <container_name> Command Use docker kill <container_name> command in the host terminal (force exit)


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

DVWA
Damn Vulnerable Web App (DVWA) is a PHP/MySQL web application that is very vulnerable. Its main goals are to be an aid for security professionals to test their skills and tools in a legal environment, to help web developers better understand the process of securing web applications, and to help teachers/students teach/learn in a classroom environment Web application security. The goal of DVWA is to practice some of the most common web vulnerabilities through a simple and straightforward interface, with varying degrees of difficulty. Please note that this software

PhpStorm Mac version
The latest (2018.2.1) professional PHP integrated development tool

SublimeText3 English version
Recommended: Win version, supports code prompts!

SecLists
SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.

ZendStudio 13.5.1 Mac
Powerful PHP integrated development environment