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

Master update #30

Merged
merged 6 commits into from
Aug 2, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 32 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Docker Support for Visual Studio Code

[![Build Status](https://travis-ci.org/Microsoft/vscode-docker.svg?branch=master)](https://travis-ci.org/Microsoft/vscode-docker) [![Release Status](https://img.shields.io/github/tag/Microsoft/vscode-docker.svg?label=prerelease&colorB=0E7FC0)](https://github.com/Microsoft/vscode-docker/releases)

The Docker extension makes it easy to build, manage and deploy containerized applications from Visual Studio Code, for example:

* Automatic `Dockerfile`, `docker-compose.yml`, and `.dockerignore` file generation (Press `F1` and search for `Docker: Add Docker files to Workspace`)
Expand All @@ -8,6 +10,8 @@ The Docker extension makes it easy to build, manage and deploy containerized app
* Command Palette (`F1`) integration for the most common Docker commands (for example `docker build`, `docker push`, etc.)
* Explorer integration for managing Images, running Containers, and Docker Hub registries
* Deploy images from Docker Hub and Azure Container Registries directly to Azure App Service
* [Working with docker](https://code.visualstudio.com/docs/azure/docker) will walk you through many of the features of this extension


## Generating Docker Files

Expand Down Expand Up @@ -41,24 +45,23 @@ You can move the View up or down by dragging the Docker icon and you can hide th

![show and hide the view](images/viewRightClick.png)

The `showExplorer` configuration setting controls the visibility of the Explorer within the Docker View.
The `showExplorer` configuration setting controls the visibility of the Docker View.

``` json
"docker.showExplorer": false
```

> Note: This setting was introduced prior to the View. Setting it to `false` will hide the Explorer within the Docker View. It does not control whether or not the View itself is visible. Future releases of the extension may be able to support a setting to toggle the visibility of the view [48704](https://github.com/Microsoft/vscode/issues/48704).

## Deploying images to Azure App Service

With the Docker Explorer you can deploy images from Docker Hub Registries or Azure Container Registries, directly to an Azure App Service instance. This functionality requires installing the [Azure Account](https://marketplace.visualstudio.com/items?itemName=ms-vscode.azure-account) extension and an Azure Subscription. If you do not have an Azure subscription, [sign up today](https://azure.microsoft.com/en-us/free/?b=16.48) for a free 30 day account and get $200 in Azure Credits to try out any combination of Azure services.

The first time you expand the Docker Hub node you'll be prompted to log into your Docker Hub account.
## Docker Hub Login
The first time you expand the Docker Hub node you'll be prompted to log in to your Docker Hub account.

![Docker Hub Login](images/dockerHubLogin.gif)

Your user name and password are stored in your operating system credentials vault (for example macOS keychain, Windows Credential Store) so that you don't need to log in every time. You can log out of Docker Hub by right clicking on the Docker Hub label and choosing log out. This will delete the credentials from the OS store.

## Deploying images to Azure App Service

With the Docker Explorer you can deploy images from Docker Hub Registries or Azure Container Registries directly to an Azure App Service instance, as detailed in this [getting started](https://code.visualstudio.com/tutorials/docker-extension/getting-started) guide. This functionality requires installing the [Azure Account](https://marketplace.visualstudio.com/items?itemName=ms-vscode.azure-account) extension and an Azure Subscription. If you do not have an Azure subscription, [sign up today](https://azure.microsoft.com/en-us/free/?b=16.48) for a free 30 day account and get $200 in Azure Credits to try out any combination of Azure services.

To log into Azure, press `F1` and search for `Azure Sign In`. You will then sign into your account using the Device Login flow. Click on "Copy & Open" to open your default browser.

![Azure Login](images/devicelogin.png)
Expand All @@ -79,9 +82,6 @@ Microsoft ships the latest [Azure CLI](https://github.com/azure/azure-cli) as a

After the container is started, you will be prompted to login to your Azure account. From there, set the subscription you want to work with using `az account set` (you can see all of your subscriptions with `az account list`). You do not need to login in every time you run the container because the extension volume mounts the local `$HOME/.azure` folder to the container's `$HOME/.azure` folder.

## Doing more with the extension
Check out this [tutorial](https://code.visualstudio.com/docs/azure/docker) to learn to utilize the other features of the extension, like linting in your docker compose file.

## Configuration Settings

The Docker extension comes with a number of useful configuration settings allowing you to customize your workflow.
Expand Down Expand Up @@ -138,6 +138,27 @@ There are a couple of ways you can contribute to this repository:

Before we can accept your pull request you will need to sign a **Contribution License Agreement**. All you need to do is to submit a pull request, then the PR will get appropriately labelled (for example `cla-required`, `cla-norequired`, `cla-signed`, `cla-already-signed`). If you already signed the agreement we will continue with reviewing the PR, otherwise system will tell you how you can sign the CLA. Once you sign the CLA all future PR's will be labeled as `cla-signed`.

## Troubleshooting

### I get "unauthorized: authentication required" in the terminal when executing some commands, such as "Docker: push".

Make sure you are signed in to the Docker Hub or Azure container registry from the docker CLI via `docker login` (using your username, not your e-mail address).

If you are using an Azure container registry, you will need to get the username and password from Azure by right-clicking on the Azure container registry in the extension and selecting "Browse in the Azure Portal", then selecting the "Access Keys" tab.
![Getting Azure username and password](images/AzureUsernamePassword.png)

Finally, execute `docker login`, for example:

```bash
docker login exampleazurecontainerregistry.azurecr.io
```

and respond with the username and password specified by Azure.

### I'm on Linux and get the error "Unable to connect to Docker, is the Docker daemon running?"

Since VS Code runs as a non-root user, you will need to follow the steps in “Manage Docker as a non-root user” from [Post-installation steps for Linux](https://docs.docker.com/install/linux/linux-postinstall/) for the extension to be able to access docker.

## Telemetry

This extension collects telemetry data to help us build a better experience for building micro-service applications with Docker and VS Code. We only collect data on which commands are executed. We do not collect any information about image names, paths, etc. The extension respects the `telemetry.enableTelemetry` setting which you can learn more about in our [FAQ](https://code.visualstudio.com/docs/supporting/faq#_how-to-disable-telemetry-reporting).
Expand Down
2 changes: 1 addition & 1 deletion commands/push-image.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export async function pushImage(context?: ImageNode): Promise<void> {
command: teleCmdId
});

if (imageName.toLowerCase().indexOf('azurecr.io')) {
if (imageName.toLowerCase().includes('azurecr.io')) {
/* __GDPR__
"command" : {
"command" : { "classification": "SystemMetaData", "purpose": "FeatureInsight" }
Expand Down
Binary file added images/AzureUsernamePassword.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/AzureUsernamePassword.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "vscode-docker",
"version": "0.1.0",
"version": "0.1.1-alpha",
"publisher": "PeterJausovec",
"displayName": "Docker",
"description": "Adds syntax highlighting, commands, hover tips, and linting for Dockerfile and docker-compose files.",
Expand Down Expand Up @@ -632,7 +632,7 @@
}
},
"engines": {
"vscode": "^1.23.0"
"vscode": "^1.25.0"
},
"scripts": {
"vscode:prepublish": "tsc -p ./",
Expand Down Expand Up @@ -662,7 +662,7 @@
"tslint-microsoft-contrib": "5.0.1",
"typescript": "^2.1.5",
"vsce": "^1.37.5",
"vscode": "^1.0.0"
"vscode": "^1.1.18"
},
"dependencies": {
"azure-arm-containerregistry": "^2.3.0",
Expand All @@ -679,6 +679,6 @@
"request-promise": "^4.2.2",
"vscode-azureextensionui": "~0.15.0",
"vscode-extension-telemetry": "^0.0.6",
"vscode-languageclient": "4.3.0"
"vscode-languageclient": "4.4.0"
}
}
28 changes: 14 additions & 14 deletions test/asyncpool.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,72 +13,72 @@ suite("AsyncPool Tests", () => {
test("Counting, Low Worker Count", async () => {
let pool = new AsyncPool(2);
let counter = 0;
for (let i = 0; i < 10000; i++) {
for (let i = 0; i < 1000; i++) {
pool.addTask(async () => {
counter++;
});
}
await pool.runAll();
assert.equal(counter, 10000);
assert.equal(counter, 1000);
})

test("Counting, High Worker Count", async () => {
let pool = new AsyncPool(300);
let counter = 0;
for (let i = 0; i < 10000; i++) {
for (let i = 0; i < 1000; i++) {
pool.addTask(async () => {
counter++;
});
}
await pool.runAll();
assert.equal(counter, 10000);
assert.equal(counter, 1000);
})

test("Counting, Resonable Worker Count", async () => {
let pool = new AsyncPool(10);
let counter = 0;
for (let i = 0; i < 10000; i++) {
for (let i = 0; i < 1000; i++) {
pool.addTask(async () => {
counter++;
});
}
await pool.runAll();
assert.equal(counter, 10000);
assert.equal(counter, 1000);
})

test("Timer, Random 1-6 ms tests", async () => {
let pool = new AsyncPool(8);
let counter = 0;
for (let i = 0; i < 1000; i++) {
for (let i = 0; i < 500; i++) {
pool.addTask(async () => {
await sleep(Math.random() * 6);
counter++;
});
}
await pool.runAll();
assert.equal(counter, 1000);
assert.equal(counter, 500);
});

test("Timer, 5ms , High Worker Count", async () => {
let pool = new AsyncPool(300);
let counter = 0;
for (let i = 0; i < 10000; i++) {
for (let i = 0; i < 100; i++) {
pool.addTask(async () => {
await sleep(5);
counter++;
});
}
await pool.runAll();
assert.equal(counter, 10000);
assert.equal(counter, 100);
});

test("Empty array", async () => {
let pool = new AsyncPool(8);
let arr = [];
for (let i = 0; i < 30000; i++) {
for (let i = 0; i < 300; i++) {
arr.push('testData' + i);
}
for (let i = 0; i < 30000; i++) {
for (let i = 0; i < 300; i++) {
pool.addTask(async () => {
arr.pop();
});
Expand All @@ -91,10 +91,10 @@ suite("AsyncPool Tests", () => {
let pool = new AsyncPool(8);
let arr: number[] = [];
let arr2: number[] = [];
for (let i = 0; i < 30000; i++) {
for (let i = 0; i < 300; i++) {
arr.push(i);
}
for (let i = 0; i < 30000; i++) {
for (let i = 0; i < 300; i++) {
pool.addTask(async () => {
arr2.push(i);
});
Expand Down