Change default Docker location

By default, Docker will store its data in /var/lib/docker. Sometimes it’s needed to change this location. There are several ways to do it. The easiest is to create the following file: /etc/systemd/system/docker.service.d/docker-storage.conf [Service] ExecStart= ExecStart=/usr/bin/docker daemon -H fd:// –graph=”/home/docker” Then you just need to refresh systemctl, make sure your folder Read more…

Install Docker on Ubuntu/Debian

Install some prerequisites: apt-get update apt-get install apt-transport-https ca-certificates curl software-properties-common Add Docker’s official GPG key: curl -fsSL | sudo apt-key add – Add the repository: add-apt-repository \ “deb [arch=amd64] \ $(lsb_release -cs) \ stable” Install Docker: apt-get update apt-get install docker-ce Try “docker info”, “docker version” or Read more…

Cleanup old docker volumes and images

Remove old images: docker images -q –no-trunc –filter dangling=true | xargs –no-run-if-empty docker rmi -f Delete all dangling volumes: docker volume ls -qf dangling=true | xargs –no-run-if-empty docker volume rm On newer Docker versions: docker image prune docker volume prune Or clean all in one command: docker system prune

Getting replication lag in PostgreSQL

Here a 2 simple queries to get the replication lag on Postgres servers: select now() – pg_last_xact_replay_timestamp() as lag; select pg_last_xlog_receive_location() receive, pg_last_xlog_replay_location() replay, ( extract(epoch FROM now()) – extract(epoch FROM pg_last_xact_replay_timestamp()) )::int lag;