Search code examples
visual-studio-codevscode-remote

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


Solution

  • 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