gpt4 book ai didi

docker - docker-compose运行,启动,启动之间的区别

转载 作者:行者123 更新时间:2023-12-02 18:53:36 25 4
gpt4 key购买 nike

我是Docker的新手。
这些有什么区别?

docker 运行``图像''

docker-compose运行“某物”

docker-compose开始'docker-compose.yml'

docker-compose up'docker-compose.yml'

提前致谢。

最佳答案

https://docs.docker.com/compose/faq/#whats-the-difference-between-up-run-and-start

What’s the difference between up, run, and start? Typically, you want docker-compose up. Use up to start or restart all the services defined in a docker-compose.yml. In the default “attached” mode, you see all the logs from all the containers. In “detached” mode (-d), Compose exits after starting the containers, but the containers continue to run in the background.

The docker-compose run command is for running “one-off” or “adhoc” tasks. It requires the service name you want to run and only starts containers for services that the running service depends on. Use run to run tests or perform an administrative task such as removing or adding data to a data volume container. The run command acts like docker run -ti in that it opens an interactive terminal to the container and returns an exit status matching the exit status of the process in the container.

The docker-compose start command is useful only to restart containers that were previously created, but were stopped. It never creates new containers.



另外: https://docs.docker.com/compose/reference/

关于docker - docker-compose运行,启动,启动之间的区别,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50315695/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com