Score:0

Can the Docker or Podman clients running on MacOS/Windows use a remote server to build/run containers?

cn flag

With MacOS and Windows as the clients and I would like to be able to have an address on my network (local or public) handle the container build steps and running the container.

So when I run something like the following, it executes on my remote machine but appears to run locally

docker build .
docker run -v .:/app -p 9000:9000 foo:latest

My hope is that I can use a thin client-like laptop to write my code while the code compiles and executes on the remote - allowing me to take advantage of a larger storage space for cached images, faster computation, sharing the processing power so I can centralize my hardware costs for maximum effect.

Also when I inevitably return to the office, I can offload work to my desktop sitting at home while using a lightweight/portable laptop in the office.

I don't care for the Desktop GUIs and don't mind if it's Podman or Docker.

Is such a setup possible or am I better off using ssh, tunneling ports and using a fuse ssh-fs implementation?

Score:1
co flag

Straight from the command line, you can do the following with Docker:

DOCKER_HOST=ssh://user@host docker build -t image:tag .

And to save a bit of typing, you can set a context to save the remote host:

docker context create remote --docker "host=ssh://user@host"

and then use that remote context with:

docker -c remote build -t image:tag .

and if you want to run all of the commands with that context, then:

# switch to the remote context for all future commands
docker context use remote
# and to revert back to the default local context
docker context use default

This works well with a build, because the build context is sent to that remote server, and so there are no local filesystem mounts.

However, once you go to run the container, things get more complicated. All of the listening ports will be on the remote host, and volume mounts will be on the remote host filesystem. If you need these capabilities, then tunneling ports and ssh-fs may be the better option. The other option that comes to mind is remote plugins in the IDE that make all code changes on the remote host over ssh so development feels like it's local even when it isn't.

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.