Disable Docker container logging

`--log-driver=none` is used for all Docker containers now.

All these containers are started through systemd anyway and get logged in journald,
so there's no need for Docker to be logging the same thing using the default `json-file` driver.
Doing that was growing `/var/lib/docker/containers/..` infinitely until service/container restart.

As a result of this, things like `docker logs matrix-synapse` won't work anymore.
`journalctl -u matrix-synapse` is how one can see the logs.
This commit is contained in:
Slavi Pantaleev 2018-09-26 09:11:19 +03:00
parent 4fbaa02bef
commit 161854e6d7
11 changed files with 33 additions and 12 deletions

View File

@ -1,3 +1,14 @@
# 2018-09-26
## Disabling Docker container logging
`--log-driver=none` is used for all Docker containers now.
All these containers are started through systemd anyway and get logged in journald, so there's no need for Docker to be logging the same thing using the default `json-file` driver. Doing that was growing `/var/lib/docker/containers/..` infinitely until service/container restart.
As a result of this, things like `docker logs matrix-synapse` won't work anymore. `journalctl -u matrix-synapse` is how one can see the logs.
# 2018-09-17 # 2018-09-17
## Service discovery support ## Service discovery support

View File

@ -10,6 +10,7 @@ Type=simple
ExecStartPre=-/usr/bin/docker kill matrix-corporal ExecStartPre=-/usr/bin/docker kill matrix-corporal
ExecStartPre=-/usr/bin/docker rm matrix-corporal ExecStartPre=-/usr/bin/docker rm matrix-corporal
ExecStart=/usr/bin/docker run --rm --name matrix-corporal \ ExecStart=/usr/bin/docker run --rm --name matrix-corporal \
--log-driver=none \
--user={{ matrix_user_uid }}:{{ matrix_user_gid }} \ --user={{ matrix_user_uid }}:{{ matrix_user_gid }} \
--network={{ matrix_docker_network }} \ --network={{ matrix_docker_network }} \
{% if not matrix_nginx_proxy_enabled %} {% if not matrix_nginx_proxy_enabled %}

View File

@ -8,6 +8,7 @@ Type=simple
ExecStartPre=-/usr/bin/docker kill matrix-coturn ExecStartPre=-/usr/bin/docker kill matrix-coturn
ExecStartPre=-/usr/bin/docker rm matrix-coturn ExecStartPre=-/usr/bin/docker rm matrix-coturn
ExecStart=/usr/bin/docker run --rm --name matrix-coturn \ ExecStart=/usr/bin/docker run --rm --name matrix-coturn \
--log-driver=none \
--user={{ matrix_user_uid }}:{{ matrix_user_gid }} \ --user={{ matrix_user_uid }}:{{ matrix_user_gid }} \
-p 3478:3478 \ -p 3478:3478 \
-p 3478:3478/udp \ -p 3478:3478/udp \

View File

@ -8,18 +8,19 @@ Type=simple
ExecStartPre=-/usr/bin/docker kill %n ExecStartPre=-/usr/bin/docker kill %n
ExecStartPre=-/usr/bin/docker rm %n ExecStartPre=-/usr/bin/docker rm %n
ExecStart=/usr/bin/docker run --rm --name %n \ ExecStart=/usr/bin/docker run --rm --name %n \
--user={{ matrix_user_uid }}:{{ matrix_user_gid }} \ --log-driver=none \
-v /etc/passwd:/etc/passwd:ro \ --user={{ matrix_user_uid }}:{{ matrix_user_gid }} \
-v /etc/group:/etc/group:ro \ -v /etc/passwd:/etc/passwd:ro \
--security-opt apparmor:unconfined \ -v /etc/group:/etc/group:ro \
--cap-add mknod \ --security-opt apparmor:unconfined \
--cap-add sys_admin \ --cap-add mknod \
--device=/dev/fuse \ --cap-add sys_admin \
-v {{ matrix_synapse_media_store_path }}:/s3:shared \ --device=/dev/fuse \
--env-file={{ matrix_environment_variables_data_path }}/goofys \ -v {{ matrix_synapse_media_store_path }}:/s3:shared \
--entrypoint /bin/sh \ --env-file={{ matrix_environment_variables_data_path }}/goofys \
{{ matrix_docker_image_goofys }} \ --entrypoint /bin/sh \
-c 'goofys -f --storage-class=STANDARD_IA --region {{ matrix_s3_media_store_region }} --stat-cache-ttl 60m0s --type-cache-ttl 60m0s --dir-mode 0700 --file-mode 0700 {{ matrix_s3_media_store_bucket_name }} /s3' {{ matrix_docker_image_goofys }} \
-c 'goofys -f --storage-class=STANDARD_IA --region {{ matrix_s3_media_store_region }} --stat-cache-ttl 60m0s --type-cache-ttl 60m0s --dir-mode 0700 --file-mode 0700 {{ matrix_s3_media_store_bucket_name }} /s3'
TimeoutStartSec=5min TimeoutStartSec=5min
ExecStop=-/usr/bin/docker stop %n ExecStop=-/usr/bin/docker stop %n
ExecStop=-/usr/bin/docker kill %n ExecStop=-/usr/bin/docker kill %n

View File

@ -8,6 +8,7 @@ Type=simple
ExecStartPre=-/usr/bin/docker kill matrix-mailer ExecStartPre=-/usr/bin/docker kill matrix-mailer
ExecStartPre=-/usr/bin/docker rm matrix-mailer ExecStartPre=-/usr/bin/docker rm matrix-mailer
ExecStart=/usr/bin/docker run --rm --name matrix-mailer \ ExecStart=/usr/bin/docker run --rm --name matrix-mailer \
--log-driver=none \
--network={{ matrix_docker_network }} \ --network={{ matrix_docker_network }} \
--env-file={{ matrix_environment_variables_data_path }}/env-mailer \ --env-file={{ matrix_environment_variables_data_path }}/env-mailer \
{{ matrix_docker_image_mailer }} {{ matrix_docker_image_mailer }}

View File

@ -10,6 +10,7 @@ Type=simple
ExecStartPre=-/usr/bin/docker kill matrix-mautrix-telegram ExecStartPre=-/usr/bin/docker kill matrix-mautrix-telegram
ExecStartPre=-/usr/bin/docker rm matrix-mautrix-telegram ExecStartPre=-/usr/bin/docker rm matrix-mautrix-telegram
ExecStart=/usr/bin/docker run --rm --name matrix-mautrix-telegram \ ExecStart=/usr/bin/docker run --rm --name matrix-mautrix-telegram \
--log-driver=none \
-e "UID={{ matrix_user_uid }}" -e "GID={{ matrix_user_gid }}" \ -e "UID={{ matrix_user_uid }}" -e "GID={{ matrix_user_gid }}" \
--network={{ matrix_docker_network }} \ --network={{ matrix_docker_network }} \
-v {{ matrix_mautrix_telegram_base_path }}:/data:z \ -v {{ matrix_mautrix_telegram_base_path }}:/data:z \

View File

@ -12,6 +12,7 @@ Type=simple
ExecStartPre=-/usr/bin/docker kill matrix-mxisd ExecStartPre=-/usr/bin/docker kill matrix-mxisd
ExecStartPre=-/usr/bin/docker rm matrix-mxisd ExecStartPre=-/usr/bin/docker rm matrix-mxisd
ExecStart=/usr/bin/docker run --rm --name matrix-mxisd \ ExecStart=/usr/bin/docker run --rm --name matrix-mxisd \
--log-driver=none \
--user={{ matrix_user_uid }}:{{ matrix_user_gid }} \ --user={{ matrix_user_uid }}:{{ matrix_user_gid }} \
--network={{ matrix_docker_network }} \ --network={{ matrix_docker_network }} \
{% if not matrix_nginx_proxy_enabled %} {% if not matrix_nginx_proxy_enabled %}

View File

@ -18,6 +18,7 @@ Type=simple
ExecStartPre=-/usr/bin/docker kill matrix-nginx-proxy ExecStartPre=-/usr/bin/docker kill matrix-nginx-proxy
ExecStartPre=-/usr/bin/docker rm matrix-nginx-proxy ExecStartPre=-/usr/bin/docker rm matrix-nginx-proxy
ExecStart=/usr/bin/docker run --rm --name matrix-nginx-proxy \ ExecStart=/usr/bin/docker run --rm --name matrix-nginx-proxy \
--log-driver=none \
--network={{ matrix_docker_network }} \ --network={{ matrix_docker_network }} \
-p 80:80 \ -p 80:80 \
-p 443:443 \ -p 443:443 \

View File

@ -10,6 +10,7 @@ ExecStartPre=-/usr/bin/docker rm matrix-postgres
ExecStartPre=-/usr/bin/mkdir {{ matrix_postgres_data_path }} ExecStartPre=-/usr/bin/mkdir {{ matrix_postgres_data_path }}
ExecStartPre=-/usr/bin/chown {{ matrix_user_uid }}:{{ matrix_user_gid }} {{ matrix_postgres_data_path }} ExecStartPre=-/usr/bin/chown {{ matrix_user_uid }}:{{ matrix_user_gid }} {{ matrix_postgres_data_path }}
ExecStart=/usr/bin/docker run --rm --name matrix-postgres \ ExecStart=/usr/bin/docker run --rm --name matrix-postgres \
--log-driver=none \
--user={{ matrix_user_uid }}:{{ matrix_user_gid }} \ --user={{ matrix_user_uid }}:{{ matrix_user_gid }} \
--network={{ matrix_docker_network }} \ --network={{ matrix_docker_network }} \
--env-file={{ matrix_environment_variables_data_path }}/env-postgres-server-docker \ --env-file={{ matrix_environment_variables_data_path }}/env-postgres-server-docker \

View File

@ -8,6 +8,7 @@ Type=simple
ExecStartPre=-/usr/bin/docker kill matrix-riot-web ExecStartPre=-/usr/bin/docker kill matrix-riot-web
ExecStartPre=-/usr/bin/docker rm matrix-riot-web ExecStartPre=-/usr/bin/docker rm matrix-riot-web
ExecStart=/usr/bin/docker run --rm --name matrix-riot-web \ ExecStart=/usr/bin/docker run --rm --name matrix-riot-web \
--log-driver=none \
--user={{ matrix_user_uid }}:{{ matrix_user_gid }} \ --user={{ matrix_user_uid }}:{{ matrix_user_gid }} \
-v {{ matrix_riot_web_data_path }}/config.json:/riot-web/webapp/config.json:ro \ -v {{ matrix_riot_web_data_path }}/config.json:/riot-web/webapp/config.json:ro \
-v {{ matrix_riot_web_data_path }}/riot.im.conf:/data/riot.im.conf:ro \ -v {{ matrix_riot_web_data_path }}/riot.im.conf:/data/riot.im.conf:ro \

View File

@ -26,6 +26,7 @@ ExecStartPre=-/usr/bin/docker rm matrix-synapse
ExecStartPre=/bin/sleep 5 ExecStartPre=/bin/sleep 5
{% endif %} {% endif %}
ExecStart=/usr/bin/docker run --rm --name matrix-synapse \ ExecStart=/usr/bin/docker run --rm --name matrix-synapse \
--log-driver=none \
--network={{ matrix_docker_network }} \ --network={{ matrix_docker_network }} \
-p 8448:8448 \ -p 8448:8448 \
{% if not matrix_nginx_proxy_enabled %} {% if not matrix_nginx_proxy_enabled %}