Skip to content

Docker: Images

4 Docker commands: Images. Click a command to see what each part does.

Index
4 items
Click a command to see what each part does.

Images4

  • docker build -t <registry>/<image>:<tag> -f <Dockerfile> .Build and tag an image

    What each part does

    1. docker buildbuild an image (BuildKit)
    2. -t <registry>/<image>:<tag>name and tag for the result
    3. -f <Dockerfile>which Dockerfile (default ./Dockerfile)
    4. .build context: the folder sent to the builder (.dockerignore trims it)
  • docker build --no-cache --pull --target <stage> --build-arg <KEY>=<value> -t <image>:<tag> .Clean rebuild of one stage with a build arg

    What each part does

    1. --no-cacheignore cached layers
    2. --pullalways check for a newer base image
    3. --target <stage>stop at a named stage of a multi-stage Dockerfile
    4. --build-arg <KEY>=<value>value for an ARG in the Dockerfile
  • docker tag <image>:<tag> <registry>/<image>:<tag> && docker push <registry>/<image>:<tag>Tag and push to a registry

    What each part does

    1. docker tag <src> <target>add another name to an existing image
    2. &&only if tagging worked
    3. docker push <target>upload it (run docker login <registry> first)
  • docker history --no-trunc <image>Image layers and what created them

    What each part does

    1. docker historyone row per layer with its size
    2. --no-truncshow the full command that created each layer

My DevOps Playbook by Angelo John Calleja

New runbook

GitHub not connected

Saving is handled by the site: the GitHub token is stored in Cloudflare, not in your browser. Enter the editor password (the EDITOR_PASSWORD secret) to unlock saving in this browser.

Saving commits to gelogrammer/My_DevOps_Playbook. Create a fine-grained token with access to only this repo andContents: Read and write, then paste it here. It is stored only in this browser.

src/content/docs/…