DOCKER-COMPOSE-EXEC(1)
π docker-compose-exec β bestie, we're going INSIDE the container
okay so this is the docker-compose-exec page, from the DOCKER-COMPOSE-EXEC(1) manual, and it's literally the glow-up you need when you wanna poke around a running service. sit down, grab a strawberry π, and let's get into it.
β¨ NAME β¨
docker-compose-exec β run a command inside a container that's already up and thriving π
β¨ SYNOPSIS β¨
docker compose exec [OPTIONS] SERVICE COMMAND [ARGS...]
β¨ DESCRIPTION β¨
so basically this is the exact same energy as docker exec, except it's aiming at a Compose service instead of a bare container. same vibe, cuter address π
with this subcommand you can run whatever arbitrary commands you want inside your services. and here's the slay: commands allocate a TTY by default, so if you do something like docker compose exec web sh you get yourself a whole interactive prompt. main character energy fr fr π
β¨ OPTIONS β¨
-d,--detach[=false]β detached mode, bestie: the command runs in the background and you just... go do other things π¦-e,--env=[]β set environment variables β¨-h,--help[=false]β the help forexec, your little map when you're lost πΊοΈ--index=0β the index of the container, for when your service has multiple replicas and you need to pick which one π―-T,--no-TTY[=true]β turn OFF pseudo-TTY allocation. reminder: by defaultdocker compose execdoes allocate a TTY, so this is you opting out π--privileged[=false]β give extended privileges to the process. powerful, use with intention β‘-u,--user=""β run the command as this user π-w,--workdir=""β path to the workdir directory for this command π
β¨ OPTIONS INHERITED FROM PARENT COMMANDS β¨
--dry-run[=false]β execute the command in dry run mode, aka a little rehearsal before the real performance π
β¨ SEE ALSO β¨
docker-compose(1)β go say hi to the parent π
ngl, this page is giving "go forth and exec responsibly" πΈ
and that's the whole thing! this lovely little page came from the Mar 2025 release of the DOCKER-COMPOSE-EXEC(1) manual. bye bestie, go run something iconic π«Άπ
π¦ where this page comes from
- debian trixie: docker-compose 2.26.1-4 Β· Apache-2.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms