Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open Docker terminal from Terminal #4892

Closed
jmsnavarro opened this issue Mar 12, 2020 · 3 comments
Closed

Open Docker terminal from Terminal #4892

jmsnavarro opened this issue Mar 12, 2020 · 3 comments
Labels
Issue-Feature Complex enough to require an in depth planning process and actual budgeted, scheduled work. Needs-Tag-Fix Doesn't match tag requirements Resolution-Won't-Fix We're just really obstinate about this. There's probably a good reason.

Comments

@jmsnavarro
Copy link

Open a Docker-hosted terminal directly using Windows Terminal

  • Possibility to add a terminal profile hosted in Docker as part of the Windows Terminal profiles.
  • This allows the user to instantly launch a terminal session hosted by Docker (provided that there is an already active container)

Proposed technical implementation details

"profiles":
    [
        {
            "guid": "{5743275e-4f2q-5b06-ad1e-a6969a402336}",
            "hidden": false,
            "name": "Ubuntu 18.04 LTS over Docker",
            "source": "Docker.Container.Ubuntu.trusted-twister",
            "fontFace" : "Cascadia Code",
            "fontSize" : 10,
            "acrylicOpacity" : 1,
            "useAcrylic" : false	
        },
@jmsnavarro jmsnavarro added the Issue-Feature Complex enough to require an in depth planning process and actual budgeted, scheduled work. label Mar 12, 2020
@ghost ghost added Needs-Tag-Fix Doesn't match tag requirements Needs-Triage It's a new issue that the core contributor team needs to triage at the next triage meeting labels Mar 12, 2020
@jmsnavarro jmsnavarro changed the title Open Docker terminal (/bin/bash) from Terminal Open Docker terminal from Terminal Mar 12, 2020
@DHowett-MSFT
Copy link
Contributor

DHowett-MSFT commented Mar 12, 2020

You’d be better served by just adding a new profile whose commandline is “docker exec -t -i container /process". Even if terminal guessed what shell you wanted inside a random container, it wouldn’t be very reliable and people would hate the autogenerating profiles for each one 😄

You know your containers a lot better than we ever could!

@DHowett-MSFT
Copy link
Contributor

Thanks, however, for the request!

@DHowett-MSFT DHowett-MSFT added Resolution-Won't-Fix We're just really obstinate about this. There's probably a good reason. and removed Needs-Triage It's a new issue that the core contributor team needs to triage at the next triage meeting labels Mar 12, 2020
@jnovick
Copy link

jnovick commented Oct 6, 2020

@jmsnavarro I have a script in my Ubuntu WSL distro for generating these profiles. I created it as an experiment. I am not sure what the practical purpose of wanting these profiles is, but you could copy and edit this t accomplish what you want. If you do not have jq installed, you can install it via sudo apt-get install -y jq. This also relies on the fact that there are no comments in the settings.json since jq cannot handle them.

VALUE=$(docker ps --format '{{ json . }}' | jq '{"name": ("Docker " + .Names + " " + .Image), "guid": ("{0974efce-f787-4a0a-8468-"+.ID+"}"), "hidden": false, "commandline": ("docker exec -it " + .Names + " /bin/bash")}' | jq -s .)
cat /mnt/c/Users/Joshua/AppData/Local/Packages/Microsoft.WindowsTerminalPreview_8wekyb3d8bbwe/LocalState/settings.json \
  | jq '.profiles.list=([.profiles.list[] | select(.name | contains("Docker") | not)] + '$VALUE')' \
  > /mnt/c/Users/Joshua/AppData/Local/Packages/Microsoft.WindowsTerminalPreview_8wekyb3d8bbwe/LocalState/settings.json

Once #7584/#7632 is done, you could leave comments in place and just direct the first line into a file instead of a variable.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Issue-Feature Complex enough to require an in depth planning process and actual budgeted, scheduled work. Needs-Tag-Fix Doesn't match tag requirements Resolution-Won't-Fix We're just really obstinate about this. There's probably a good reason.
Projects
None yet
Development

No branches or pull requests

3 participants