docker vs docker-compose decryption-Alibaba Cloud Developer Community

Directory

  • preface
  • body
    • docker
    • docker-compose
    • the difference between the two
    • the connection between the two
  • end

preface

those who play container deployment must know docker and docker-compose very well, but what are the obvious differences and connections between them? Do you know it clearly? Today we will decrypt one or two.

Body

docker

docker generally refers to containerization technology, which can be used to create and use Linux containers. docker allows you to use containers as lightweight and modular virtual machines. With flexibility, containers can be created, deployed, replicated, and migrated efficiently.

docker-compose

docker-compose is an open-source project based on docker. It is generally used to manage container service and quickly orchestrate docker container clusters by calling the docker service API. The specific implementation method is to define a set of related container services in a yaml configuration file.

The difference between the two

start command scope of Application configuration file required dependencies degree of difficulty

another point to special attention, that is in the modify container code, using docker-compose restart command is not take effect the, you need to first docker-compose stop, execute docker-compose start can. However, if you modify the docker-compose.yaml configuration file, the docker-compose restart command takes effect. However, if you use the docker restart command, the modified code and configurations in the container take effect immediately. You do not need to stop and restart the container.

The connection between the two

to use docker-compose and docker commands, both must be installed. docker itself has already met the basic operation and management of container service. The appearance of docker-compose only simplifies the management of docker service to a certain extent, and essentially relies on docker commands, the docker API. docker commands can be used separately. To use the docker-compose command, you must first install docker.

End

docker and docker-compose are excellent tool sets for container service management. You 'd better master both methods to understand the internal principles of container service deployment and management. Well, that's all for today's content.

Author's brief introduction: Hello everyone, I am liuzhen007, an audio and video technology enthusiast, and also a CSDN blog expert, Huawei cloud enjoyment expert, and a signed Author of InfoQ. Welcome to follow me and share more dry goods!

Please read this disclaimer carefully before you start to use the service. By using the service, you acknowledge that you have agreed to and accepted the content of this disclaimer in full. You may choose not to use the service if you do not agree to this disclaimer. This document is automatically generated based on public content on the Internet captured by Machine Learning Platform for AI. The copyright of the information in this document, such as web pages, images, and data, belongs to their respective author and publisher. Such automatically generated content does not reflect the views or opinions of Alibaba Cloud. It is your responsibility to determine the legality, accuracy, authenticity, practicality, and completeness of the content. We recommend that you consult a professional if you have any doubt in this regard. Alibaba Cloud accepts no responsibility for any consequences on account of your use of the content without verification. If you have feedback or you find that this document uses some content in which you have rights and interests, please contact us through this link: https://www.alibabacloud.com/campaign/contact-us-feedback. We will handle the matter according to relevant regulations.
Selected, One-Stop Store for Enterprise Applications
Support various scenarios to meet companies' needs at different stages of development

Start Building Today with a Free Trial to 50+ Products

Learn and experience the power of Alibaba Cloud.

Sign Up Now