¿Any one has experience using any kind of cloud servers or VPS with docker and VS Code for programming? I think that the process of create a docker container it will be similar as in my own PC ¿Can you access the container from VS Code as simple as it would be running locally?
I assume VSCode to leverage docker context to communicate with the docker engine of the remote host.
You can create a context and switch amongst contexts like this:
# create the context for the remote docker engine
docker context create myvps --docker "host=ssh://myuser@ip-or-domain-or-remote-host"
# switch to the myvps context, to use the remote host's docker engine
docker context use myvps
# switch back to local docker engine (replacee `default`with `desktop-linux` in case of Docker Desktop)
docker context use default
If the docker context uses a context all commands will be executed against that particular context, until you switch to another context.
Ideally you use key pair based authentication for the ssh login.
An alternative approach would be to enable tcp binding for the docker engine and use mlts two way auth, though I don’t remmend it, as it’s harder to setup and a misconfiguration can become a huge security problem.