docker Compose
When installing docker on windows and mac, docker compose is installed by default. For linux, please refer to https://docs.docker.com/compose/install/
for detailed docker-compose.yml writing format reference: https://docs.docker. com/compose/compose-file/
services
- A service represents a container, which can be created from the image of dockerhub, or from the image built by the local Dockerfile.
- Service startup is similar to docker run, we can specify network and volume for it, so we can specify network and volume references to service.
Common commands of docker-compose
run a docker-compose.yml
docker-compose up
Running docker-compose.yml in the current path is equivalent to the following command
docker-compose -f docker-compose.yml up
background execution
docker-compose up -d
Start docker-compose
docker-compose start
close docker-compose
docker-compose stop
Stop and delete containers, networks, images and volumes
docker-compose down
View the images used
docker-compose images
enter service
docker-compose exec service名