Docker on a Cloud Server or in a VPS

Hi there,

I hope some one can light up my path.

I’m noob in docker, for now I’ve create my own docker container where I develop my python programms with VS Code. No problems so far.

The thing is I want to move my containers betwen my Laptop and my main PC for example. I’ve already try move them by USB but it’s not what I want.

I found the option of use Cloud Servers or VPS, such as “https://www.hostalia.com/” or “https://clouding.io/”. They say that support Docker.

¿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?

Thank you so much in advance

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.

Thank you meyay for the reply. For now I connect with my server through ssh and VSCode finds my running container.

Although I’ll learn how the docker context works.