I have a laptop running Ubuntu 22.04, and a desktop computer running Ubuntu 24.04, within the same LAN. I would like to be able to attach a docker container running on the desktop, from the laptop. Basically, I would like to be able to connect Dev Container of VS Code (on the laptop) to the actual docker running on the desktop pc through ethernet or wifi. Any change or execution of the code must happen on the desktop.
I mean, it can be seen as a docker attach, but extended to remote docker containers. I tried to follow this guide: https://docs.docker.com/config/daemon/remote-access/ this one: https://www.docker.com/blog/how-to-deploy-on-remote-docker-hosts-with-docker-compose/
and few other resources, but it does not work. Anyone who knows why?
This is the container I am trying to edit: https://github.com/DanielRossi1/ai-base-docker
I managed to solve this problem by establishing first an SSH configuration between the two hosts, then I configured docker context to exploit that configuration in order to connect to the remote docker engine.
Here's an automated and guided script that does it for you: https://github.com/DanielRossi1/ai-base-docker/blob/main/remote.sh
If anyone is able to provide a better solution, please post it here.