preinstall VScode remote extensions in a docker container - kubernetes

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

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 ./)

Remote Kubernetes development in Spyder (Python) with Okteto

For Visual Studio Code (VSC) it is possible to install the Remote-Kubernetes extension which allows you to work directly with remote development environments, spinning them up, configuring them etc. More info here.
Is something similar possible for Spyder?
I am aware that a connection to a remote kernel can be made but this seems to require for the remote environment to already be running. Am looking for same functionality as the okteto up command in VSC.

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?

VSCode: Using dev container remotely without local installation of docker

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.

Integrate Visual Studio Code into Google Cloud

How can I interact with the code on my Google App Engine instance from Visual Studio Code?
You can now run Visual Studio Code from the Google Cloud Shell using
https://github.com/cdr/code-server/
It comes down to downloading code-server, starting it and using the Web Preview functionality of Google Cloud Shell to use it.
See also:
https://medium.com/#chees/how-to-run-visual-studio-code-in-google-cloud-shell-354d125d5748
You can use SSHFS to mount a remote directory on a Google Cloud Virtual Machine (VM). It is very easy to setup and use compared to VNC or FTP:
First you have to access the VM via ssh. This is actually very easy and you don't need to generate any keys yourself. Just go to the console then: Compute Engine > VM Instances, then locate your instance and click on the SSH button at the far right. Tutorial and more info here.
Install SSHFS on your machine. If you have a mac, you can use brew cask install osxfuse and then brew install sshfs.
You are ready. Just type sshfs [you_user_name]#[external_ip_of_vm]:[directory_on_vm_to_mount_to] [local_mount_point], eg. sshfs john#35.222.222.1:/home/john ~/john-vm.
If you decided to setup VNC, here is a link to a very good tutorial on how to set it up on GC. And here is another link on how to setup SFTP.
You can check VSCode remote as well. It was recently developed and is already in quite stable stage. Probably Remote SSH will help you the most in your case.