Docker

Permit user to use docker command

sudo usermod -aG docker <user>

Build and push image

docker login [-u <username>] [server]
docker build -t <[registry/]name[:version]> .
docker push <[registry/]name[:version]>

Build image for multiple cpu architectures

export DOCKER_CLI_EXPERIMENTAL=enabled
docker run --rm --privileged docker/binfmt:a7996909642ee92942dcd6cff44b9b95f08dad64
docker buildx create --use --name multi-arch-builder
docker buildx inspect --bootstrap # check architectures
# then you can copy desired architectures to --platform argument
docker buildx build --platform=linux/amd64,linux/arm64,linux/arm/v7 -t kelgors/gemweb:1.0.0 .

Get running containers size

docker ps -as

Remove unused stuff from Docker

# remove dangling images
docker images prune
# remove dangling containers/networks/images
docker system prune

Last-Updated:

Content also available on gemini://kelgors.me/wiki/docker.gmi

More info about Gemini protocol