Cheat Sheet - Docker

Cheat Sheet - Docker

Push image to Azure Container Registry

az login 
az acr login --name myregistry
docker tag killerapp/backend myregistry.azurecr.io/killerapp/backend
docker push myregistry.azurecr.io/killerapp/backend

Verify a docker installation

docker run -it hello-world 
docker run -it -p <localPort>:<containerPort> <image>

Build and tag image

docker build -t killerapp/backend:dev .

List running containers

docker container ls

Run container interactively and remove it afterwards

docker run -it --rm image:tag sh
docker run --interactive --tty --rm image:tag sh

List local images

docker image ls

Inspect image content

# First option 
docker run -it <image-name> sh

# Second option
docker run -it --entrypoint sh <image-name>

# Third option
docker image history --no-trunc <image-name> > image_history