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!

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