VSCode: Using dev container remotely without local installation of docker - visual-studio-code

Currently, I have:
a desktop with low system specs, Windows 7 Pro (without Admin Rights), without docker.
a Virtual Machine with Centos7, and docker installed.
On my desktop, I can either use:
my local installation of VSCode, and Remote - SSH to develop remotely on my VM. It works well, but I can't combine this with Remote - Containers.
X11Forwarding to develop directly with VSCode installed on this VM. I can use Remote - Containers, but X11 is very slow.
Is there a way, with local VSCode, to develop in a remote container, without local installation of docker (obviously with docker installed on the host)?

Is there a way, with local VSCode, to develop in a remote container,
without local installation of docker (obviously with docker installed
on the host)?
No. In the 'advanced containers' docs it says
You can use the Docker CLI locally with a remote Docker host by
setting local environment variables like DOCKER_HOST,
DOCKER_CERT_PATH, DOCKER_TLS_VERIFY. Since VS Code uses the Docker CLI
under the hood, you can use these same environment variables to
connect the Remote - Containers extension to the same remote host.
I added the bolding. Note that it is referring to the client not the remote there. This is from Developing inside a container on a remote Docker host.
Though not officially supported, it seems that it is possible to install Docker CLI without the daemon...
Is it possible to install only the docker cli and not the daemon
Maybe you can do this without admin?
That would, though, certainly be swimming against the grain. Probably your best bet is to stick with the 'remote - SSH' setup you've got going.

I just achieved this using the solution linked by #Tom (but with admin rights, I didn't test it without them)
I downloaded the docker-cli from the docker-cli-builder github repo and created the docker context successfully.
After selecting it in VSCode, it has started using the context allowing me to see the containers on the remote machine.

We have build a small tool called LiveSync which could solve your problem. You simply run
python3 -m pip install livesync
livesync <virtual-machine>
from inside your vscode workspace. It will start watching for changes and push them immediately to the remote. Hence you can code locally (even run your tests) and have all changes synced with your target system.

Related

Visual Studio Code remote access to a WSL2:ubuntu on my desktop from my macbook

've looked around and can't seem to find the answer to this - probably because the feature is pretty new.
I tried the remote WSL:ubuntu connection on my windows desktop machine to connect to my WSL2 Ubuntu running on the same machine. This is pretty much perfect as it allows access to my Nvidia GPU under linux
Is there anyway I can do the same trick from my macbook? I can connect to the windows side of the desktop using the new remote tunnel feature but I'm drawing a blank on how to do for the WSL buried in that machine. It looks like it's just using the same remote connection feature so I'm thinking it should be possible but WSL2 network is not exposed the same way you can with a VM or other machine.
The desktop has way more everything than my macbook including a nvidia GPU I want to use for some machine learning.
I can do it from the desktop itself - but it's nice to be able to use that machine from my macbook at certain times of day.
I have recently started using VSCode so I'm on the learning curve with it - it may well be that it's not possible using the new remote tunnels - or requires some messing with adding a new hyper-v bridged adapter to the WSL installation. I'm hoping against hope there's an easy solve that I've somehow missed.
I tried setting up the remote tunnel as per https://code.visualstudio.com/blogs/2022/12/07/remote-even-better but it seems to setup a server to access windows not the WSL2 service.
Thanks for any help!
I had a similar problem and found this github issue. While the developers are looking into including this feature, you currently will need to install the VSCode CLI directly in WSL. You can find the downloads here
Notes
I would recommend the x64 CLI download in the Linux section. It will download a tar.gz file which will have a file named code in it when extracted.
The tunnel will launch from wherever you place that code file, so I put mine in the ~/ (home) directory.
You can then open a tunnel using the command ./code tunnel from that location. You can replace the . with the path to the code file to open the tunnel while in a different directory, i.e. ~/code.
You can still launch a tunnel from Windows with code tunnel. (note that this command does not have ./)

preinstall VScode remote extensions in a docker container

I'm currently using the vscode extension to attach to running containers in Kubernetes as described here: https://code.visualstudio.com/docs/remote/attach-container.
When attaching vscode will install some extensions in the remote container - this works reliably, but it quite slow.
Is it possible to figure out how to install these extensions into the base image so that remote connection can happen quickly?
Thanks

Use Settings Sync or Syncing vscode extensions with remote SSH environment

I am using VSCode 1.38.1 and I connect to a remote docker environment running sshd with SSH using the Remote - SSH 0.46.1 extension.
Everything works smoothly and I can install/uninstall extensions in the remote docker container with the VSCode.
However, I cannot find a way to use the Settings Sync 3.4.3 (latest) extension to sync my extensions/settings in the remote docker container.
It seems that it can be installed only locally and not on the Remote SSH environment. Is there any way to use it with the remote environment?
Also, could you please suggest me an alternative settings syncing extension? I have also tried Syncing 3.0.9 extension which can be installed remotely but when I download the extensions/settings from the gist file it loops forever.
.
By creating a symbolic link from .vscode-server to .vscode in the remote environment everything works smoothly. Also, only the Syncing extensions 3.0.1 version works correctly with syncing.
I try the same way, it looks still not working.
I am connecting the remote linux server(not container), the remote server specific setting is not synced to gist after "Upload/Update Settings", it looks only local PC setting uploaded to gist.
did you try to configure remote specific setting (which is not same as local PC) and sync it?

Running eclipse with remote Git checkout repository

On my windows laptop, I use putty to ssh on the remote server where I have git checkout a C project. I would like to use eclipse(CDT) for program development on my laptop but compilation and program execution is only possible on the remote server. Can I map the repository checked out on remote server into eclipse on my laptop so that I can avoid working with two copies of the checked out project.
This seems not possible unless you are using an Eclipse installed on the remote machine... and use it on your Windows laptop.
See "Remote Eclipse over X11".
Since you are on Windows, you would use an X11 emulator like vcxsrv.
That would avoid the sshfs setup.
The other approach would be to replicate your remote machine environment in a VM (VirtualBox) or a Docker image/container in order to be able to compile locally (and then push the modified sources to your remote machine with Git)

How to select Docker host to use with new Eclipse Liberty WDT tools

With last version of Liberty WDT tools for Eclipse, a Liberty server running in a Docker can be configured as server. It works for me and detects the dockers running in a remote host, not locally. I wonder how Liberty has decided to use that specific docker host and how I can configure another one. I mean, the equivalent to the comand:
#eval $(docker-machine env MY_HOST)
I use in shell to select where my docker commands go to.
I see nowhere in preferences where I can set which set of "docker-machine env" will the tool use.
Thanks
The tools don't assume any particular Docker machine but should be listing containers running WebSphere Application Server Liberty on all machines with the machine name in brackets next to the container name. The tools will handle setting up the environment required for the container that is chosen. Containers must be started to show in the list.