Run a container with an env file

Local run with variables from .env; --rm deletes the container on exit

docker run --rm -it --env-file .env -p 8000:8000 img:tag

tool
docker46 commands
tags
docker

More docker commands

  • docker history --no-trunc img:tag

    Shows each layer with its command and size; helps find what makes the image so big

  • docker system prune -af --volumes

    Deletes stopped containers and all unused images, networks and volumes

  • docker pull src-reg/img:tag && docker tag src-reg/img:tag dst-reg/img:tag && docker push dst-reg/img:tag

    Pulls the image, adds a new tag and pushes it to another registry

  • docker save img:tag | gzip > img.tar.gz

    Exports an image to move it into an air-gapped network

  • docker build --build-arg VERSION=1.2.3 --build-arg ENV=prod -t img:tag .

    Passes build-time variables to ARG instructions in the Dockerfile

all 46 docker commands