Docker進階操做

本次主題

[x] docker-compose install
[x] docker-logs clean
[] dockefilehtml

docker-compose install

二進制包

官方定義編譯好二進制包,供你們使用。這些發佈的二進制包能夠在 https://github.com/docker/compose/releases 頁面找到。git

這些二進制文件,下載後直接放到執行路徑下,並添加執行權限便可。github

例如,在 Linux 平臺上。docker

$ sudo curl -L https://github.com/docker/compose/releases/download/1.8.0/docker-compose-`uname -s`-`uname -m` > /usr/local/bin/docker-compose
$ sudo chmod a+x /usr/local/bin/docker-compose

能夠使用 docker-compose version 命令來查看版本信息,以測試是否安裝成功。json

$ docker-compose version
docker-compose version 1.8.0, build 94f7016
docker-py version: 1.9.0
CPython version: 2.7.6
OpenSSL version: OpenSSL 1.0.1f 6 Jan 2014

docker logs clean

一個腳本bash

#!/bin/sh

echo "==================== start clean docker containers logs =========================="

logs=$(find /var/lib/docker/containers/ -name *-json.log)

for log in $logs
        do
                echo "clean logs : $log"
                cat /dev/null > $log
        done


echo "==================== end clean docker containers logs   =========================="

參考連接:docker-compose

相關文章
相關標籤/搜索