At the moment for my personal setup:
- The VSCode window that I never explicitly quit, I use it to first SSH to the remote server.
- With the docker extension I then go ahead and attach the container to VSCode for development by right clicking on the docker and selecting the relevant option to attaching the container to the IDE.
But there are too many clicks and ticks involved.
I was looking into VSCode tasks to automate some of the process (if and wherever possible) to avoid this clickity click that I have to do daily.
Here’s what I have been able to achieve so far:
{
"version": "1.0.0",
"tasks": [
{
"label": "Connect to SSH and Attach to Docker opening a directory",
"type": "shell",
"group": {
"kind": "remote",
"isDefault": true
},
"presentation": {
"reveal": "always",
"panel": "new"
},
"dependsOn": [],
"preLaunchTask": "",
"problemMatcher": //what goes here?,
"run": {
"command": "ssh ${config:remoteUser}@${config:remoteHost}"
},
"options": {
"cwd": "${workspaceFolder}"
},
"env": {
"containerName": "your_container_name"
},
"inputs": [
{
"name": "remoteHost",
"type": "string",
"description": "SSH Hostname",
"default": "your_ssh_hostname",
"prompt": "Enter the SSH hostname of the remote machine:"
},
{
"name": "remoteUser",
"type": "string",
"description": "SSH Username",
"default": "your_ssh_username",
"prompt": "Enter the SSH username for the remote machine:"
}
]
}
]
}
but I don’t understand how I can attach docker to vs code using this and open a directory I need after attaching to it.