docker_compose_exec.yaml 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  1. command: docker compose exec
  2. short: Execute a command in a running container
  3. long: |-
  4. This is the equivalent of `docker exec` targeting a Compose service.
  5. With this subcommand, you can run arbitrary commands in your services. Commands allocate a TTY by default, so
  6. you can use a command such as `docker compose exec web sh` to get an interactive prompt.
  7. By default, Compose will enter container in interactive mode and allocate a TTY, while the equivalent `docker exec`
  8. command requires passing `--interactive --tty` flags to get the same behavior. Compose also support those two flags
  9. to offer a smooth migration between commands, whenever they are no-op by default. Still, `interactive` can be used to
  10. force disabling interactive mode (`--interactive=false`), typically when `docker compose exec` command is used inside
  11. a script.
  12. usage: docker compose exec [OPTIONS] SERVICE COMMAND [ARGS...]
  13. pname: docker compose
  14. plink: docker_compose.yaml
  15. options:
  16. - option: detach
  17. shorthand: d
  18. value_type: bool
  19. default_value: "false"
  20. description: 'Detached mode: Run command in the background'
  21. deprecated: false
  22. hidden: false
  23. experimental: false
  24. experimentalcli: false
  25. kubernetes: false
  26. swarm: false
  27. - option: env
  28. shorthand: e
  29. value_type: stringArray
  30. default_value: '[]'
  31. description: Set environment variables
  32. deprecated: false
  33. hidden: false
  34. experimental: false
  35. experimentalcli: false
  36. kubernetes: false
  37. swarm: false
  38. - option: index
  39. value_type: int
  40. default_value: "0"
  41. description: Index of the container if service has multiple replicas
  42. deprecated: false
  43. hidden: false
  44. experimental: false
  45. experimentalcli: false
  46. kubernetes: false
  47. swarm: false
  48. - option: interactive
  49. shorthand: i
  50. value_type: bool
  51. default_value: "true"
  52. description: Keep STDIN open even if not attached
  53. deprecated: false
  54. hidden: true
  55. experimental: false
  56. experimentalcli: false
  57. kubernetes: false
  58. swarm: false
  59. - option: no-tty
  60. shorthand: T
  61. value_type: bool
  62. default_value: "true"
  63. description: |
  64. Disable pseudo-TTY allocation. By default `docker compose exec` allocates a TTY.
  65. deprecated: false
  66. hidden: false
  67. experimental: false
  68. experimentalcli: false
  69. kubernetes: false
  70. swarm: false
  71. - option: privileged
  72. value_type: bool
  73. default_value: "false"
  74. description: Give extended privileges to the process
  75. deprecated: false
  76. hidden: false
  77. experimental: false
  78. experimentalcli: false
  79. kubernetes: false
  80. swarm: false
  81. - option: tty
  82. shorthand: t
  83. value_type: bool
  84. default_value: "true"
  85. description: Allocate a pseudo-TTY
  86. deprecated: false
  87. hidden: true
  88. experimental: false
  89. experimentalcli: false
  90. kubernetes: false
  91. swarm: false
  92. - option: user
  93. shorthand: u
  94. value_type: string
  95. description: Run the command as this user
  96. deprecated: false
  97. hidden: false
  98. experimental: false
  99. experimentalcli: false
  100. kubernetes: false
  101. swarm: false
  102. - option: workdir
  103. shorthand: w
  104. value_type: string
  105. description: Path to workdir directory for this command
  106. deprecated: false
  107. hidden: false
  108. experimental: false
  109. experimentalcli: false
  110. kubernetes: false
  111. swarm: false
  112. inherited_options:
  113. - option: dry-run
  114. value_type: bool
  115. default_value: "false"
  116. description: Execute command in dry run mode
  117. deprecated: false
  118. hidden: false
  119. experimental: false
  120. experimentalcli: false
  121. kubernetes: false
  122. swarm: false
  123. deprecated: false
  124. hidden: false
  125. experimental: false
  126. experimentalcli: false
  127. kubernetes: false
  128. swarm: false