/var/log

Docker info

Some docker info and commands I use a lot.

Bash shell

// First check your ID
docker ps
// Then use this ID to get to the bash shell
docker exec -it [ID] bash

Custom prefix

By default Docker prefixes your container and volume names with the directory it's running in. For example I have a couple of projects with the trunk sub directory where I run docker from. If I run Docker from this sub directory, my volume name will be for example "trunk_db". To choose a custom prefix you can set the COMPOSE_PROJECT_NAME inside the .env file, for example:

COMPOSE_PROJECT_NAME=my_project_name

Convert image to another architecture

First create a new directory and add a Dockerfile with one line in it:

FROM jwilder/nginx-proxy

See if we already have a builderx builder:

docker buildx ls

If you see mybuilder in the output, you already have one. If you haven't one yet, do:

docker buildx create --name mybuilder

Now activate this one:

docker buildx use mybuilder

Now go into the new directory with the new Dockerfile.

Yyou can convert an image to for example arm64 (for Mac Silicon):

docker buildx build --platform linux/arm64 -t my-new-image-name --load .
Tag: | Category: