I have a running container on a remote host. I can ssh this host. I can exec on the running container from the host.
I would like to persist some changes that I make directly on my container files on my local machine. To this aim I need to sync the container files with my local machine. I would be interested in a rsync or sshfs command to do so.
To provide more context, I am trying to find a development flow on a legacy system where I cannot run the container locally. I am using vscode remote extensions to develop on the remote container which works well. Yet my container is orchestrated and can be killed at any moment, I need to persist locally the development changes. Any other idea that could address the development workflow is also welcome.
I thought about creating a volume bridge on the host machine and sync directly from the host to my local machine. However, this is not an option for other reasons.
sshdin your remote container, and expose the ssh port to the host, or is that a security risk? If you can run it, than the situation is the same as for rsync via any jump host, so see e.g. here. Also look into Docker volumes to be able to use persistent storage from containers that can be restarted any time. – dirkt Jul 17 '21 at 05:49