搜索
登录
注册
×
欢迎来到小雕博客,玩的开心。
Docker实践09-compose命令
博主:
alone
发布时间:
2020-08-28T01:20:36Z
106次浏览
0 条评论
Compose常用命令 ## 1. 命令 docker-compose --help会看到如下这么多命 ```shell build Build or rebuild services bundle Generate a Docker bundle from the Compose file config Validate and view the Compose file create Create services down Stop and remove containers, networks, images, and volumes events Receive real time events from containers exec Execute a command in a running container help Get help on a command images List images kill Kill containers logs View output from containers pause Pause services port Print the public port for a port binding ps List containers pull Pull service images push Push service images restart Restart services rm Remove stopped containers run Run a one-off command scale Set number of containers for a service start Start services stop Stop services top Display the running processes unpause Unpause services up Create and start containers version Show the Docker-Compose version information ``` ## 2. 常用命令 ```shell docker-compose up ``` 用于部署一个 Compose 应用 默认情况下该命令会读取名为 docker-compose.yml 或 docker-compose.yaml 的文件 当然用户也可以使用 -f 指定其他文件名。通常情况下,会使用 -d 参数令应用在后台启动 ```shell docker-compose stop ``` 停止 Compose 应用相关的所有容器,但不会删除它们 被停止的应用可以很容易地通过 docker-compose restart 命令重新启动 ```shell docker-compose rm ``` 用于删除已停止的 Compose 应用 它会删除容器和网络,但是不会删除卷和镜像 ```shell docker-compose restart ``` 重启已停止的 Compose 应用 如果用户在停止该应用后对其进行了变更,那么变更的内容不会反映在重启后的应用中,这时需要重新部署应用使变更生效 ```shell docker-compose ps ``` 用于列出 Compose 应用中的各个容器 输出内容包括当前状态、容器运行的命令以及网络端口 ```shell docker-compose down ``` 停止并删除运行中的 Compose 应用 它会删除容器和网络,但是不会删除卷和镜像
き 赞赏
如果觉得我的文章对你有用,请随意赞赏
×
Close
赞赏作者
扫一扫支付
支付宝支付
微信支付
发表评论
发表评论
评论内容