Skip to content

Instantly share code, notes, and snippets.

@eric-glb
Last active March 16, 2023 18:18
Show Gist options
  • Save eric-glb/cc5aa42b1c9761df76ff557d197147d2 to your computer and use it in GitHub Desktop.
Save eric-glb/cc5aa42b1c9761df76ff557d197147d2 to your computer and use it in GitHub Desktop.
[docker] logs, logs, logs

[docker] logs, logs, logs...

Increase the log size in docker when building a container

On a centos7

# The service file for docker.service, on a centos7
service_file=/lib/systemd/system/docker.service

# Parameters we want to add
TO_ADD=$(cat <<'EOF'
Environment="BUILDKIT_STEP_LOG_MAX_SIZE=1073741824"
Environment="BUILDKIT_STEP_LOG_MAX_SPEED=10240000"
EOF
)

# add these parameters after the "Restart=..." line of the file
awk -v to_add="$TO_ADD" '{ if(/Restart=/) {print; print to_add} else {print} }' $service_file \
  > /tmp/$(basename $service_file)

# overwrite the docker.service file with the new one
cat /tmp/$(basename $service_file) | sudo tee $service_file

# Reload, restart
sudo systemctl daemon-reload
sudo systemctl restart $(basename $service_file) 

How to have a plain output of the build

export BUILDKIT_PROGRESS=plain

or use the --progress=plain option for docker build (default value: auto)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment