3

I am trying to create a Docker context with VS Code to enable me to deploy the container to Azure, following this microsoft tutorial.

The image shown in the tutorial has a button with a plus to create a new context, but my version does not have this button. I have the latest version of VS Code (1.55.0), the latest version of Docker (Docker version 19.03.13) and the Docker extension for VS Code, which has worked for every other step of this tutorial series and allowed me to stop and start containers as well as other features. I have tried this using Ubuntu 18.04.5 and 20.04.2, and followed the Linux instructions for installing Docker.

I am logged into Azure with VS Code and have deployed other things to Azure via VS Code, although I don't think that should make a difference.

Here is what I see in the context panel:

my_docker_context_panel.

Here is what is shown in the tutorial:

tutorial_docker_context_panel.

Why don't I have the option to add a context through VS Code? How can I get it? Thanks.

Gama11
  • 31,714
  • 9
  • 78
  • 100
JustTrying
  • 33
  • 4

1 Answers1

-2

It depends on VSCode's Keyboard Shotcuts. I can reproduce it:

enter image description here

You can set the Keyboard Shotcuts. Then the button will apear. Below is the steps:

  1. Go to the View -> Command Palette, input the command docker context create like this:

enter image description here

  1. Set the Keyboard Shotcuts, for example, here is my setting:

enter image description here

  1. Then use the Keyboard Shotcuts, here it means click the Shift + Alt + C button, it shows like this:

enter image description here

Charles Xu
  • 29,862
  • 2
  • 22
  • 39
  • 1
    Thanks for answering. I don't have that option appear when I type into the search bar, I instead get this https://imgur.com/a/zcJXNaK which seems unable to find `docker context create` as a commamd – JustTrying Apr 08 '21 at 19:08
  • @JustTrying Read the answer carefully. You need to finish the first two steps. – Charles Xu Apr 09 '21 at 01:33
  • @JustTrying Any updates on this question? Does it solve your problem? If it works for you please accept it. – Charles Xu Apr 13 '21 at 02:07
  • 1
    Hi, thanks for replying. I am not sure what you mean for me to try. I try to do step 1, but this does nothing as I simply get a the no matching commands shown above, so although I do try to do this step it does nothing. It looks to me like in your screenshot in step 1, your VS Code finds the command you are looking for and allows you to click on it to assign a keybinding? But I can't do that. I cannot get an output from step 1, only that message. – JustTrying Apr 13 '21 at 18:26
  • @JustTrying You need to input the command yourself. Take a look at [this](https://code.visualstudio.com/docs/getstarted/keybindings). And you also need to install the docker extension for the vs code. – Charles Xu Apr 14 '21 at 01:21
  • This has allowed me to create a context thank you. I should mention for others that it doesn't add the plus button as shown in the tutorial and your screenshot, but the keyboard shortcut does the same thing so I can still create a context in VS Code. – JustTrying Apr 14 '21 at 12:39