building prometheus inside a container

Don’t install go, instead build it inside the go container;

docker run --rm -v %CD%:/go/src/ -w /go/src/ golang:1.10 make build

Run it inside that docker container too!

docker run --rm -v %CD%:/go/src/ -w /go/src/ -p 9090:9090 golang:1.10 ./prometheus

Note: I executed the following to have it use a test config;

copy ./config/testdata/conf.good.yml ./prometheus.yml

bringing up containers in azure

Create a resource group

az group create --name myGroup --location eastus

Create the container

az container create --resource-group myGroup --name myName --image tensorflow/tensorflow --dns-name-label myDnsName --ports 8888

Show status

az container show --resource-group myGroup --name myName --query "{FQDN:ipAddress.fqdn,ProvisioningState:provisioningState}" --out table

set container timezone

Set the TZ environment variable inside linux containers to set the timezone, for example docker run -e TZ={timezone} or, for example inside your docker-compose;

    TZ: "Australia/Sydney"

using docker without sudo

sudo gpasswd -a $USER docker

azure container repository login

az login
az acr login --name repoName

accessing windows event viewer

Accessing Event Viewer in a docker container Using the Windows EventViewer GUI to view Eventlogs in Containers

updating running containers

# set to always restart
docker update --restart=always <container>

# rename
docker rename <container> <new name>

run container indefinitely

Set the command to tail -f /dev/null


docker run -d node tail -f /dev/null

install docker via cloudformation

docker swarm ports

docker disk usage

Find large directories

du -ah / | sort -h -r | head -n 20

Find containers using a given volume

docker ps -a --filter volume=<volume>

Remove container and its associated volume

docker rm -v container

See total volume, image, container space

docker system df

See space used per volume

docker system df -v

Remove dangling volumes from disk

docker volume prune

wsl uses all the ram


Force linux to drop the page cache

echo 1 | sudo tee /proc/sys/vm/drop_caches

limit memory assigned to WSL2 VM

Create a %UserProfile%\.wslconfig file


add container to another container's network

For example, adding the container some-postgis to the same network as the container postgres_adminer_1.

Find the NetworkID of the network:

docker inspect postgres_adminer_1 -f ""

Add the container to the network:

docker network connect f51952f2eb6ea17fbf1917b3609b99f2a70cce8b4e1e1c35177bcb4388ff1124 some-postgis