

1·
3 years agoProtip: you can configure the default host bind IP via /etc/docker/daemon.json. You could for example set:
{
"ip": "127.0.0.1"
}
which would result in -p "8080:8080" being equivalent to -p "127.0.0.1:8080:8080"


Protip: you can configure the default host bind IP via /etc/docker/daemon.json. You could for example set:
{
"ip": "127.0.0.1"
}
which would result in -p "8080:8080" being equivalent to -p "127.0.0.1:8080:8080"
The biggest footgun I encounter every time I set up a raspberry pi or other linux host for a side project is forgetting that Docker doesn’t do log rotation for containers’ logs by default, which results in the service going down and seeing a sweat inducing ENOSPC error when you ssh in to check it out.
You can configure this by creating
/etc/docker/daemon.jsonand either setting up log rotation withlog-optsor using thelocallogging driver (it defaults tojson) if you’re not shipping container logs anywhere and just read the logs locally. Thelocaldriver compresses the logs and automatically does log rotation:{ "log-driver": "local", "log-opts": { "max-size": "10m", "max-file": "3" } }