DsCpp
DsCpp

Reputation: 2489

No "open folder in container" or any other command in remote-containers vs code

I'm using a remote machine, and want to run a docker inside that machine (local->remote->docker) and wish to use the Remote development in Containers tools of vs code Unfortunatlly, I do not see any of the actions after installing the extension. My view (ctrl+shift+p -> type remote-containers) enter image description here While the tutorial has actions I don't even see: enter image description here

Upvotes: 5

Views: 11449

Answers (3)

Caleb Jay
Caleb Jay

Reputation: 2199

I had this issue when I opened vscode for the first time in a year after only needing to install it for some random project that wanted me to use "dev containers" for, I don't remember what.

But I don't care about dev containers anymore and I don't remember that project, however, vscode was functionally unusable because it opened in that old project directory and was trying to do... something with containers. I don't know, I don't care, I just wanted to open another folder so a junior programmer could use an IDE on my machine they're familiar with instead of emacs/vim/whatever.

The solution for me was to use the "extensions" tab CTRL+SHIFT+X, disable the "Dev Containers" extension, then use "File -> Open Recent Folder" to select some other directory. This gets around the "can't open in container" bug. If you don't have a history of other opened directories, I think you need to completely reinstall Vscode or something.

Upvotes: 1

sReall
sReall

Reputation: 56

You need to make sure you are not connected to your remote host via Remote-SSH in VSCode. If you are, you will not see "Open Folder in Container..." or the other options.

Try opening up VSCode without connecting using Remote-SSH. You will find that the option is now present.

To set up a remote Docker host, you first need to be able to access your remote host using key based authentication as describe here

You then set

"docker.host":"ssh://your-remote-user@your-remote-machine-fqdn-or-ip-here"

in setting.json.

Once that is setup, you can only attach to running containers. Test this out before proceeding:

  1. Start a container on the remote host
  2. Hit F1 in your vscode and then select "Attach to Running Container..."
  3. You should see the container you started and you should be able to attach to this

Once you are past this point, you will need to create your devcontainer.json file as per the documentation

Upvotes: 3

user1880022
user1880022

Reputation: 21

Make sure you have installed Remote Container extension. and ssh as mentioned on the comment above. Once installed, click on Docker icon, under containers, right click on the container you need to work with vcode and select attach vscode.

Upvotes: 0

Related Questions