GithubHelp home page GithubHelp logo

microsoft / vscode-docker Goto Github PK

View Code? Open in Web Editor NEW
1.2K 100.0 506.0 44.45 MB

Docker Extension for Visual Studio Code

Home Page: https://marketplace.visualstudio.com/items?itemName=ms-azuretools.vscode-docker

License: Other

TypeScript 98.98% JavaScript 0.80% Shell 0.12% Python 0.10%
dockerfile docker vscode docker-compose

vscode-docker's Introduction

Docker for Visual Studio Code Version Installs

The Docker extension makes it easy to build, manage, and deploy containerized applications from Visual Studio Code. It also provides one-click debugging of Node.js, Python, and .NET inside a container.

Docker extension overview

Check out the Working with containers topic on the Visual Studio Code documentation site to get started.

The Docker extension wiki has troubleshooting tips and additional technical information.

Installation

Install Docker on your machine and add it to the system path.

On Linux, you should enable rootless Docker and set the generated Docker context to "rootless" (more secure) or enable Docker CLI for the non-root user account (less secure) that will be used to run VS Code.

To install the extension, open the Extensions view, search for docker to filter results and select Docker extension authored by Microsoft.

Overview of the extension features

Editing Docker files

You can get IntelliSense when editing your Dockerfile and docker-compose.yml files, with completions and syntax help for common commands.

IntelliSense for Dockerfiles

In addition, you can use the Problems panel (Ctrl+Shift+M on Windows/Linux, Shift+Command+M on Mac) to view common errors for Dockerfile and docker-compose.yml files.

Generating Docker files

You can add Docker files to your workspace by opening the Command Palette (F1) and using Docker: Add Docker Files to Workspace command. The command will generate a Dockerfile and .dockerignore file and add them to your workspace. The command will also ask you if you want to add Docker Compose files as well, but this is optional.

The extension can scaffold Docker files for most popular development languages (C#, Node.js, Python, Ruby, Go, and Java) and customizes the generated Docker files accordingly. When these files are created, we also create the necessary artifacts to provide first-class debugging support for Node.js, Python, and .NET (C#).

Docker Explorer

The Docker extension contributes a Docker Explorer view to VS Code. The Docker Explorer lets you examine and manage Docker assets: containers, images, volumes, networks, and container registries.

The right-click menu provides access to commonly used commands for each type of asset.

Docker view context menu

You can rearrange the Docker view panes by dragging them up or down with a mouse and use the context menu to hide or show them.

Customize Docker view

Docker commands

Many of the most common Docker commands are built right into the Command Palette:

Docker commands

You can run Docker commands to manage images, networks, volumes, image registries, and Docker Compose. In addition, the Docker: Prune System command will remove stopped containers, dangling images, and unused networks and volumes.

Docker Compose

Docker Compose lets you define and run multi-container applications with Docker. Our Compose Language Service in the Docker extension gives you IntelliSense and tab completions when authoring docker-compose.yml files. Press Ctrl+Space to see a list of valid Compose directives.

Docker Compose IntelliSense

We also provide tooltips when you hover over a Docker Compose YAML attribute.

Docker Compose Tooltips

While Compose Up allows you to run all of your services at once, our new feature Compose Up - Select Services lets you select any combination of the services you want to run.

Docker Compose Up - Select Subset

Once your Compose Up command completes, navigate to the Docker Explorer to view your services as a Compose Group. This allows you to start, stop, and view the logs of each service as a group.

Docker Compose Groups

Using image registries

You can display the content and push, pull, or delete images from Docker Hub and Azure Container Registry:

Azure Container Registry content

An image in an Azure Container Registry can be deployed to Azure App Service directly from VS Code. See Deploy images to Azure App Service to get started. For more information about how to authenticate to and work with registries, see Using container registries.

Debugging services running inside a container

You can debug services built using Node.js, Python, or .NET (C#) that are running inside a container. The extension offers custom tasks that help with launching a service under the debugger and with attaching the debugger to a running service instance. For more information, see Debug containerized apps and Customize the Docker extension.

Azure CLI integration

You can start Azure CLI (command-line interface) in a standalone, Linux-based container with Docker Images: Run Azure CLI command. This gives you access to the full Azure CLI command set in an isolated environment. For more information on available commands, see Get started with Azure CLI.

Contributing

See the contribution guidelines for ideas and guidance on how to improve the extension. Thank you!

Code of Conduct

This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact [email protected] with any additional questions or comments.

Telemetry

VS Code collects usage data and sends it to Microsoft to help improve our products and services. Read our privacy statement to learn more. If you don’t wish to send usage data to Microsoft, you can set the telemetry.telemetryLevel setting to off. Learn more in our FAQ.

License

MIT

vscode-docker's People

Contributors

alexeyrokhin avatar alexyaang avatar allanwright avatar audioboxer217 avatar brettcannon avatar bwateratmsft avatar chrisdias avatar danegsta avatar dependabot[bot] avatar ejizba avatar jnsjunior avatar johnpapa avatar karolz-ms avatar kieferrm avatar lazarusx avatar lostintangent avatar nedex avatar olivermking avatar philliphoff avatar prashanthcorp avatar ravipal avatar rcjsuen avatar remcohaszing avatar rosanch avatar sandipchitale avatar sgreenmsft avatar stephenweatherford avatar stuartthomson avatar tasosval avatar uchenkadicode avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

vscode-docker's Issues

add support for multi stage docker files

probably just need to update the default dockerfile template.

https://codefresh.io/blog/node_docker_multistage/

//cc: @lostintangent

rough idea...

FROM node:latest AS base
WORKDIR /usr/src/app
COPY package.json .

FROM base AS dependencies
RUN npm set progress=false && npm config set depth 0
RUN npm install --only=production
RUN cp -R node_modules prod_node_modules
RUN npm install

FROM dependencies AS build
COPY . .
RUN ./node_modules/.bin/gulp
RUN cp -R client prod_client

FROM base AS release
COPY --from=dependencies /usr/src/app/prod_node_modules ./node_modules
COPY --from=build /usr/src/app/prod_client ./client
COPY . .
EXPOSE 3000
CMD npm run start

Support to custom registries

Would be nice to have support to different registries (image repositories), like a server list or something related.

Support custom named Dockerfiles

The extension seems to works only with "Dockerfile" named files, and in some situation you have to set custom name (multiple dockerfiles in a single directory for docker composer for instance).

The probleme is i didnt see any name convention in such situations, some people are using Dockfile_foo, compose's doc is using Dockerfile-foo, and some people names it foo.docker ...

Dockerfile syntax highlighting for escaped quotes is not quite right

Given the following dockerfile snippet...

# setup a new user
COPY compiler.sudoers /etc/sudoers.d/compiler
RUN chmod 0440 /etc/sudoers.d/compiler && \
    adduser --disabled-password --gecos \"\" compiler && \
    usermod -a -G sudo compiler
USER compiler
WORKDIR /home/compiler
CMD ["/bin/bash"] ["--login"]

The escaped quotes after gecos appear to throw off the syntax highlighting.

selection_014

Add command to run a system prune

Docker 1.13 added the docker system prune command, which is amazingly useful for development, since it cleans up all unused containers, images, volumes, networks, etc. in one command. We should consider adding a command to this extension for it (e.g. Docker: System Prune).

Run command should allow specifying ports that need to be published

The Docker: Run command that this extension adds to VS Code doesn't provide a way to specify which (if any) ports within the container should be exposed to the host. This makes it hard to use this command for many containers, and therefore, requires you to drop down to using the terminal directly. This isn't a big deal, but since the Docker: Add docker files to workspace command asks which port to expose, it would seemingly make sense for the Docker: Run command to provide a similar experience, for publishing ports at runtime.

Add proper HEALTHCHECK colorization/intellisense

This PR introduces basic colorization of the HEALTHCECK command in Dockerfiles, however, it doesn't support colorization of the healtcheck sub-commands (NONE and CMD) or any of the options (--interval, --timeout, --retry).

screen shot 2016-12-04 at 10 16 58 pm

Additionally, the Dockerfile language service should provide auto-completion support for the HEALTHCHECK command, in order to make it easier to author.

The newly added linting support already fully supports validating the various permutations of the HEALTHCHECK command, and we have a snippet as well, so we just need to finish the colorization/auto-complete.

add vscode-docker to recommendation list

can we add this to the package.json for insiders and stable?

extension:
"PeterJausovec.vscode-docker":

file patterns:

Dockerfile
dockerfile
docker-compose*.yml

Provide auto-completion of tags for Docker repositories

It would be awesome to have auto-completion for the list of available tags within a specified repository. For example, if I have FROM node: in my Dockerfile and type CTRL+Space after the colon, it would be really useful to see the list of tags for that exact repository (e.g. 6-slim), without needing to go to its DockerHub page to determine them. Apologies if this behavior already exists and I missed it somehow.

question : generalized version of providing this for yaml files

Hello,

I have a yaml file and would love to provide an editing experience for it in vs code.

I just wanted to check before re-purposing this. Is there a generalized version of this? Where I can supply the "grammar", hints etc an it just plugs in?

Thank you,
Doug

Typo in extensions store description

"The Docker extension it easy to build and deploy containerized applications from Visual Studio Code." should probably be "The Docker extension makes it easy to build and deploy containerized applications from Visual Studio Code."

Dockerfile language detection is too generic

If you open a file that starts with dockerfile, regardless what it's extension is (e.g. dockerfilewhatever.foo), it will be detected as a Dockerfile, which I'm not sure makes sense. Having this VS Code extension simply detect Dockerfile or dockerfile (with the former being the standard) seems reasonable and should cover most use cases, without introducing any false positives.

Allow customization of shell to run

We should allow for the user to specify which shell to run (both windows and linux) when executing the command "Attach shell to running container".

Add support for Docker Toolbox (docker-machine)

On Windows prior to version 10, the only solution to run docker is virtual machine. The most popular setup is probably Docker Toolbox kit, which provides docker-machine tool, setting up boot2docker virtual machine.

Do you plan to add a support for it, so that when you open a terminal a command eval $(docker-machine env) setting up docker is run before target command?

If it is something would be worth adding, I could look play around with it.

Enable Docker build to keep history of the image:tag that the user has specified for a Dockerfile

Users currently have to retype the tag specified during build if the tag is not of the form {folder}:latest.
Enabling a history of the tags currently built for a file would enable the user to simply rebuild the docker file without having to retype this over again ..

For e.g. If the user runs docker build with a image:tag as shown below the expectation is that the extension remembers this πŸ˜€
image

As part of the dev inner loop it would nice if rebuild can keep history of tag instead of the default -> Also might be worth considering deriving the tag from the file extension.

image

Reuse terminal windows when possible

We spawn a lot of terminal windows... would be great if we could know if a terminal is busy in VS Code or not, then we could reuse.

Need support from Code for this...

Provide a VSIX file for download.

Would it be possible to provide the latest version as a VSIX file for download and installation on a machine that doesn't have access to the VSCode Marketplace?

Thanks.

Does not support Windows containers

I'm using Windows containers for another Microsoft OSS project and found this extension assumes Linux containers. For example, when I tried to attach to an existing container and the extension ran docker exec but assumed /bin/sh. In fact, it seems odd to assume that even for Linux since a developer hopefully specified ENTRYPOINT potentially overriding the shell.

VSCode on Windows 10 + Docker: Wrong build path

From @max06 on January 1, 2017 13:29

  • VSCode Version: 1.8.1 (stable)
  • OS Version: Windows 10 Build 14393

Steps to Reproduce:

  1. Install Docker for Windows
  2. Install VSCode
  3. Add Docker extension
  4. Create an empty Folder (eg MicroServiceTemplate) and open it in VSCode
  5. Generate a Dockerfile from the command palette with default settings
  6. Run Docker: Build from the command palette

Here the questions are already filled with the wrong values, like selecting the Dockerfile, it shows e\Dockerfile

The Build fails then with C:\Users\max06\OneDrive\Dokumente\Develop\MicroServiceTemplate>docker build -f e\Dockerfile -t e:latest e unable to prepare context: unable to evaluate symlinks in context path: GetFileAttributesEx C:\Users\max06\On eDrive\Dokumente\Develop\MicroServiceTemplate\e: Das System kann die angegebene Da tei nicht finden.

When I try to build it manually with correct parameters, it works.

Copied from original issue: microsoft/vscode#17986

Logs command should allow following log output

The log command currently prints the current log contents for the specified container, however, it doesn't allow following the log stream for the container, which for many diagnostic scenarios, it really useful. It would be great if the command allowed specifying whether the user would like to follow the logs or not.

Debug Container

Hello guys,

I would like to know if this extension would accept a PR adding debugging capabilities for a container...

Initially the idea is to make it debug .Net Core applications that are hosted in (multiple) containers and the debugger could be eventually extended to support other types of applications like node.js for example...

If that is the case, I can work on the .Net Core part initially and later on extend it for other techs.

The idea is to make something similar to the experience we have on VS2017 and docker tooling there where you can add the initial docker files (this extension does the very basic already), create the whole infra from the docker (compose) files and then attach a debugger to it.

How does it sound?

Thanks

.Net Core Asks me to Install .Net Core SDK

So I created an empty web application from vs2017. Then opened that in VS Code and added docker files which auto-generated, I built the image from the extension and then tried running the image from the extension...

It says, Did you mean to run dotnet SDK commands? Please install dotnet SDK from: [URL]

I have dotnet SDK installed already as I can create from the command line no problem. Been installed for a long time. So what am I doing wrong here? Shouldn't this be handled in the image that's downloaded? The one that's auto-generated in the docker file?

File associations

Is there any chance to associate all docker-* files (non-default name) with the "Dockerfile" language for a project or globally?

This setting doesn't work:

"files.associations": {
       "docker-*": "Dockerfile"
}

Files.associations setting probably works only with the build-in types of languages like PHP, JavaScript ...

Image details are not shown in yml file

For example, line:
'''
image: ubuntu
'''

The image details are not displayed if you hover over ':'. However, if you add an extra space before 'image ...' everything works fine. Probably an issue in the parser.

Support "context-based" completion for compose files

Currently, the completion support for compose files simply displays a list of all possible properties, regardless of the cursor's position in the file. For example, bringing up the completion list at the top-level of a v2 file should only display services, volumes and networks, since those are the only allowable properties.

Adding this support would not only provide the user with a more "guided" authoring experience (why should someone need to remember which properties they can use at a specific position?), but it would allow us to display customized documentation for properties that exist in multiple contexts (e.g. the driver property could indicate a custom logging driver, network driver, volume driver, etc.).

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.