Docker exec as root

Enter container as root even if default user is non-root

docker exec -it -u root <container> bash

tool
docker46 commands
tags
dockerdebug

More docker commands

  • docker cp ./local-file.conf <container>:/etc/app/config.conf

    Inject a file into a running container without rebuild

  • docker load < img.tar.gz

    Import an image exported with docker save

  • docker exec -it registry bin/registry garbage-collect /etc/docker/registry/config.yml

    Free disk space in a self-hosted Docker Registry

  • docker build --target builder -t img:builder .

    Build only up to a specific stage in a multi-stage Dockerfile

  • docker build --build-arg APP_VERSION=1.2.3 --build-arg ENV=prod -t myapp:1.2.3 .

    Pass build-time variables to Dockerfile ARG instructions

all 46 docker commands