12

I'm writing code with VSCode from inside a VSCode container.

I can open terminals inside the dev container, but I can't figure out how to open a (VSCode integrated) terminal in my local machine.

I can of course open a separate terminal application like iTerm2, but it's far more convenient to use VSCode's integrated terminal panel. Is opening a local terminal possible with VSCode dev containers?

Chris Hayes
  • 11,505
  • 6
  • 33
  • 41

2 Answers2

12

This solution is provided in the Accepted Answer on this SO question, so if the below helps, go and upvote that.

Using the command palette (default ctrl+shift+p/cmd+shift+p), there is an option

Terminal: Create New Integrated Terminal (local)

enter image description here

James G
  • 2,069
  • 16
  • 28
2

Provided that you have key-based SSH access from the container to the host, you can add a terminal profile to your remote settings (run command Preferences: Open Remote Settings (JSON) (Dev Container) to open them):

{
    "terminal.integrated.profiles.linux": {
        "bash (Host)": {
            "path": "ssh",
            "icon": "terminal-bash",
            "args": [
                "user@host",
            ],
        },
    },
}

This will get you an according bash (Host) entry in your "Add Terminal" drop-down menu:

enter image description here

carlfriedrich
  • 2,919
  • 1
  • 15
  • 29