custom docker-compose run commands #3064
-
Hello, forgive me, but i couldn't find enough documentation around this: i was wondering if there was a way to setup custom commands for docker-compose (https://docs.docker.com/compose/reference/run/) such that when i click on a docker-compose.yml file the command would appear in there? |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments
-
@bva-mike I do not think there is a way to add custom commands to VS Code Explorer nodes other than by writing a VS Code extension. @philliphoff please chime in if I am missing something. That said, you can use tasks to set up any Docker Compose invocations, either using Docker Extension Compose task type, or just regular shell task. With a custom key binding like {
"key": "alt+t",
"command": "workbench.action.tasks.runTask"
} it can be quite easy to invoke these tasks. The limitation is, they won't be able to operate on any Compose files, only the ones configured for each task. |
Beta Was this translation helpful? Give feedback.
-
Correct, to add commands to a file's context menu, you'd need to write an extension. The good news is that writing extensions (especially for exposing individual commands) is fairly straightforward and the documentation is good, and doesn't require you to actually publish it (if you don't want to). |
Beta Was this translation helpful? Give feedback.
-
@karolz-ms / @philliphoff - ah i see, thanks for the info guys! I'll take a look at writing a small extension! |
Beta Was this translation helpful? Give feedback.
Correct, to add commands to a file's context menu, you'd need to write an extension. The good news is that writing extensions (especially for exposing individual commands) is fairly straightforward and the documentation is good, and doesn't require you to actually publish it (if you don't want to).