1
0
mirror of https://github.com/bingohuang/docker-labs.git synced 2025-07-13 17:42:53 +08:00

Limit the container log size to avoid filling the disk

This commit is contained in:
Marcos Lilljedahl 2017-05-04 12:43:06 -03:00
parent 6acb6f47c5
commit 5ac8131a10

View File

@ -200,7 +200,12 @@ func ResizeConnection(name string, cols, rows uint) error {
} }
func CreateInstance(session *Session, dindImage string) (*Instance, error) { func CreateInstance(session *Session, dindImage string) (*Instance, error) {
h := &container.HostConfig{NetworkMode: container.NetworkMode(session.Id), Privileged: true, AutoRemove: true} h := &container.HostConfig{
NetworkMode: container.NetworkMode(session.Id),
Privileged: true,
AutoRemove: true,
LogConfig: container.LogConfig{Config: map[string]string{"max-size": "10m", "max-file": "1"}},
}
if os.Getenv("APPARMOR_PROFILE") != "" { if os.Getenv("APPARMOR_PROFILE") != "" {
h.SecurityOpt = []string{fmt.Sprintf("apparmor=%s", os.Getenv("APPARMOR_PROFILE"))} h.SecurityOpt = []string{fmt.Sprintf("apparmor=%s", os.Getenv("APPARMOR_PROFILE"))}