The stuff I do

Docker cheatsheet

← Notes

Tags: [docker]

docker exec reference

Run interactive shell on container

docker exec -it <container_id> bash

Run command on container

docker exec -d <container_id> touch /tmp/test

Set an environment variable in the current bash session.

docker exec -it -e VAR=1 <container_id> bash

Select working directory for the command to execute into

 docker exec -it -w /root <container_id> pwd

← Notes