Docker-Compose

Docker-Compose

Docker-Compose

1. Create file docker-compose.yml


version: '3.9'

services:

?web:

??image: nginx


?database:

??image: redis


two container services web and database

2 to check the YAML file configuration :

-docker-compose config

3. Launch Docker Containers or docker-compose up builds, (re)creates, starts, and attaches to containers for a service.

docker-compose up

If you docker-compose up and one of your containers finishes its task and gets (auto)removed, then you can't docker-compose stop and docker-compose start again. The removed container will not be there to start it again.



4. List docker containers

?docker-compose ps

5. to remove deployed Containers:??

docker compose down

要查看或添加评论,请登录

社区洞察

其他会员也浏览了