指令:
# docker-compose rm -s -v service_name
或是參數合在一起也可以
# docker-compose rm -sv service_name
Options:
-f, --force Don't ask to confirm removal
-s, --stop Stop the containers, if required, before removing
-v, --volumes Remove any anonymous volumes attached to containers
舉例
docker-compose.yml 內容
web_lab:
container_name: container_web_lab
image: myweb:5.5.5
depends_on:
- mysqldb
root@srv:/helloworld# docker-compose rm -sv web_lab
[+] Running 1/1
⠿ Container container_web_lab Stopped 1.5s
? Going to remove container_web_lab Yes
[+] Running 1/1
⠿ Container container_web_lab Removed 0.6s
root@srv:/helloworld# docker-compose up -d web_lab
[+] Running 2/2
⠿ Container web_db Running 0.0s
⠿ Container container_web_lab Started
留言列表