DOCKER-COMPOSE-EXEC(1)

πŸ“¦ version 2.26.1, in debian trixie

πŸ’… 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 for exec, 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 default docker compose exec does 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 ✨


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