Skip to content
This repository has been archived by the owner on Nov 30, 2023. It is now read-only.

Commit

Permalink
Worked on READMEs
Browse files Browse the repository at this point in the history
  • Loading branch information
Chuxel committed Mar 24, 2019
1 parent ba980f9 commit 21e95dd
Show file tree
Hide file tree
Showing 6 changed files with 125 additions and 32 deletions.
23 changes: 23 additions & 0 deletions container-templates/docker-compose/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# [Name of Definition Here]

## Summary

*[A short description of the the purpose of the definition goes here.]*

| Metadata | Value |
|----------|-------|
| *Contributors* | [Your name, email and/or GitHub profile] |
| *Definition type* | Docker Compose |
| *Languages, platforms* | [Languages and platforms the container supports] |

## Description

[Give a more detailed description of the container if the summary does not provide enough info.]

## Usage

[Optional - Provide any information on steps required to use the definition.]

## How it works

[Optional - If the definition provides a pattern you think will be useful for others, describe the pattern here.]
23 changes: 23 additions & 0 deletions container-templates/dockerfile/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# [Name of Definition Here]

## Summary

*[A short description of the the purpose of the definition goes here.]*

| Metadata | Value |
|----------|-------|
| *Contributors* | [Your name, email and/or GitHub profile] |
| *Definition type* | Dockerfile |
| *Languages, platforms* | [Languages and platforms the container supports] |

## Description

[Give a more detailed description of the container if the summary does not provide enough info.]

## Usage

[Optional - Provide any information on steps required to use the definition.]

## How it works

[Optional - If the definition provides a pattern you think will be useful for others, describe the pattern here.]
23 changes: 23 additions & 0 deletions container-templates/image/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# [Name of Definition Here]

## Summary

*[A short description of the the purpose of the definition goes here.]*

| Metadata | Value |
|----------|-------|
| *Contributors* | [Your name, email and/or GitHub profile] |
| *Definition type* | Image |
| *Languages, platforms* | [Languages and platforms the container supports] |

## Description

[Give a more detailed description of the container if the summary does not provide enough info.]

## Usage

[Optional - Provide any information on steps required to use the definition.]

## How it works

[Optional - If the definition provides a pattern you think will be useful for others, describe the pattern here.]
16 changes: 15 additions & 1 deletion containers/docker-in-docker-compose/README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,24 @@
# Docker in Docker Compose

## Summary

*Illustrates how you can use it to access your local Docker install from inside the a dev container by simply volume mounting the Docker unix socket. This variation uses Docker Compose to do the volume mounting.*

> **Note:** You can also check out the [Dockerfile](../docker-in-docker) variation of this same definition.
| Metadata | Value |
|----------|-------|
| *Contributors* | The VS Code team |
| *Definition type* | Docker Compose |
| *Languages, platforms* | Any |

## Description

Dev containers can be useful for all types of applications including those that also deploy into a container based-environment. While you can directly build and run the application inside the dev container you create, you may also want to test it by deploying a built container image into your local Docker Desktop instance without affecting your dev container. This example illustrates how you can do this by running CLI commands and using the [Docker VS Code extension](https://marketplace.visualstudio.com/items?itemName=PeterJausovec.vscode-docker) right from inside your dev container.

Note that the included `dev-container.dockerfile` can be altered to work with other Debian/Ubuntu based-container images such as `node` or `python`. Simply update `FROM` statement in the file to change the starting image. For example:
## Usage

No additional setup steps are required, but note that the included `dev-container.dockerfile` can be altered to work with other Debian/Ubuntu based-container images such as `node` or `python`. Simply update `FROM` statement in the file to change the starting image. For example:

```Dockerfile
FROM node:8
Expand Down
16 changes: 15 additions & 1 deletion containers/docker-in-docker/README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,24 @@
# Docker in Docker

## Summary

*Illustrates how you can use it to access your local Docker install from inside the a dev container by simply volume mounting the Docker unix socket. This variation uses `runArgs` and a `Dockerfile` to do the volume mounting*

> **Note:** You can also check out the [Docker Compose](../docker-in-docker-compose) variation of this same definition.
| Metadata | Value |
|----------|-------|
| *Contributors* | The VS Code team |
| *Definition type* | Dockerfile |
| *Languages, platforms* | Any |

## Description

Dev containers can be useful for all types of applications including those that also deploy into a container based-environment. While you can directly build and run the application inside the dev container you create, you may also want to test it by deploying a built container image into your local Docker Desktop instance without affecting your dev container. This example illustrates how you can do this by running CLI commands and using the [Docker VS Code extension](https://marketplace.visualstudio.com/items?itemName=PeterJausovec.vscode-docker) right from inside your dev container.

Note that the included `dev-container.dockerfile` can be altered to work with other Debian/Ubuntu based-container images such as `node` or `python`. Simply update `FROM` statement in the file to change the starting image. For example:
## Usage

No additional setup steps are required, but note that the included `dev-container.dockerfile` can be altered to work with other Debian/Ubuntu based-container images such as `node` or `python`. Simply update `FROM` statement in the file to change the starting image. For example:

```Dockerfile
FROM node:8
Expand Down
56 changes: 26 additions & 30 deletions containers/kubernetes-helm/README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,17 @@
# Kubernetes and Helm

## Summary

*Illustrates how you access a Kubernetes cluster from inside a dev container. Includes the Docker CLI, kubectl, and Helm.*

| Metadata | Value |
|----------|-------|
| *Contributors* | The VS Code team |
| *Definition type* | Dockerfile |
| *Languages, platforms* | Any |

## Description

Dev containers can be useful for all types of applications including those that also deploy into a container based-environment. While you can directly build and run the application inside the dev container you create, you may also want to test it by deploying a built container image into a local or remote [Kubernetes](https://kubernetes.io/) cluster without affecting your dev container. This example illustrates how you can do this by using CLIs, the [Kubernetes extension](https://marketplace.visualstudio.com/items?itemName=ms-kubernetes-tools.vscode-kubernetes-tools), and the [Docker extension](https://marketplace.visualstudio.com/items?itemName=PeterJausovec.vscode-docker) right from inside your dev container.

This example builds up from the [docker-in-docker](../docker-in-docker) container definition to add Kubernetes and Helm support.
Expand All @@ -8,54 +20,38 @@ The dev container includes the needed CLIs ([kubectl](https://kubernetes.io/docs

To get started, follow the appropriate steps below for your operating system.

## macOS Setup
## Usage

### macOS / Windows Setup

1. Install "Docker Desktop for Mac" locally if you have not.
1. Install "Docker Desktop for Mac" / "Docker Desktop for Windows" locally if you have not.

2. Start Docker, right-click on the Docker icon and select "Preferences..."

3. Check **Kubernetes > Enable Kubernetes**

4. Open this folder in VS Code

5. Edit `.vscode/devConatiner.json` and change `$HOME` in the last item in the `runArgs` array to the absolute path of your home folder. e.g.
5. Edit `.vscode/devConatiner.json` and change `$HOME` in the last item in the `runArgs` array to the absolute path of your home / user profile folder. e.g. On macOS:

```json
"runArgs": ["-e", "SYNC_LOCALHOST_KUBECONFIG=true",
"-v", "/var/run/docker.sock:/var/run/docker.sock",
"-v", "/Users/clantz/.kube:/root/.kube-localhost"]
```
> **Note:** Resolving [vscode-remote#670](https://github.com/Microsoft/vscode-remote/issues/670) will remove this step.
6. Run the **Remote: Reopen folder in Container** command. Once connected, you should see your clusters in the Kubernetes explorer.

7. [Optional] If you want to use [Helm](https://helm.sh), open a VS Code terminal and run:
```
helm init
```

## Windows Setup

1. Install "Docker Desktop for Windows" locally if you have not.

2. Right Click on Docker system tray icon and select "Settings"

3. Check **General > "Expose daemon on tcp://localhost:2375 without TLS"**
On Windows:

4. Check **Kubernetes > Enable Kubernetes**

5. Open this folder in VS Code

6. Edit `.vscode/devConatiner.json` replace the **entire** contents `runArgs` of with the following. Replace `C:\\Users\\clantz\\` with the path your your user directory.
```json
"runArgs": ["-e", "SYNC_LOCALHOST_KUBECONFIG=true",
"-e", "DOCKER_HOST=tcp://host.docker.internal:2375",
"-v", "/var/run/docker.sock:/var/run/docker.sock",
"-v", "C:\\Users\\clantz\\.kube:/root/.kube-localhost"]
```

> **Note:** Resolving [vscode-remote#670](https://github.com/Microsoft/vscode-remote/issues/670) and [vscode-remote#669](https://github.com/Microsoft/vscode-remote/issues/669) will remove this step.
7. Run the **Remote: Reopen folder in Container** command. Once connected, you should see your clusters in the Kubernetes explorer.
6. Run the **Remote: Reopen folder in Container** command. Once connected, you should see your clusters in the Kubernetes explorer.

8. [Optional] If you want to use [Helm](https://helm.sh), open a VS Code terminal and run:
7. [Optional] If you want to use [Helm](https://helm.sh), open a VS Code terminal and run:
```
helm init
```
Expand Down Expand Up @@ -91,7 +87,7 @@ To get started, follow the appropriate steps below for your operating system.

The trick that makes this work is as follows:

1. Install all of the needed CLIs. From `dev-container.dockerfile`:
1. Install all of the needed CLIs in the container. From `dev-container.dockerfile`:

```Dockerfile
# Install Docker CE CLI
Expand All @@ -111,15 +107,15 @@ The trick that makes this work is as follows:
RUN curl -s https://raw.githubusercontent.com/helm/helm/master/scripts/get | bash -
```

2. Forward the Docker socket and mount the local `.kube` folder so the configuration can be reused. From `devContainer.json`:
2. Forward the local Docker socket and mount the local `.kube` folder in the container so the configuration can be reused. From `devContainer.json`:

```json
"runArgs": ["-e", "SYNC_LOCALHOST_KUBECONFIG=true",
"-v", "/var/run/docker.sock:/var/run/docker.sock",
"-v", "$HOME/.kube:/root/.kube-localhost"]
```

3. Update `.bashrc` to automatically copy the local machine's Kubernetes config into the container and swap out localhost for host.docker.internal whenever a new shell starts to keep them in sync. From `dev-container.dockerfile`:
3. Update `.bashrc` to automatically copy the local machine's Kubernetes config into the container and swap out localhost for host.docker.internal whenever a new shell starts. From `dev-container.dockerfile`:

```Dockerfile
RUN echo 'if [ "$SYNC_LOCALHOST_KUBECONFIG" == "true" ]; then \
Expand Down

0 comments on commit 21e95dd

Please sign in to comment.