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

Commit

Permalink
Debian as base, reduce chances of errors due to release version
Browse files Browse the repository at this point in the history
  • Loading branch information
Chuxel committed Apr 13, 2019
1 parent 70f5e74 commit 69b93b6
Show file tree
Hide file tree
Showing 19 changed files with 65 additions and 86 deletions.
10 changes: 5 additions & 5 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,20 @@
# Licensed under the MIT License. See LICENSE in the project root for license information.
#-----------------------------------------------------------------------------------------

FROM ubuntu:bionic
FROM debian:9

# Install git
RUN apt-get update \
&& apt-get install -y git

# Install Docker CE CLI. If you choose a Debian based image, update https://download.docker.com/linux/ubuntu
# to https://download.docker.com/linux/debian on the third line below.
# Install Docker CE CLI
RUN apt-get install -y apt-transport-https ca-certificates curl gnupg-agent software-properties-common \
&& curl -fsSL https://download.docker.com/linux/ubuntu/gpg | apt-key add - \
&& add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" \
&& curl -fsSL https://download.docker.com/linux/$(lsb_release -is | tr '[:upper:]' '[:lower:]')/gpg | apt-key add - \
&& add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/$(lsb_release -is | tr '[:upper:]' '[:lower:]') $(lsb_release -cs) stable" \
&& apt-get update \
&& apt-get install -y docker-ce-cli


# Clean up
RUN apt-get autoremove -y \
&& apt-get clean -y \
Expand Down
Empty file added awk
Empty file.
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
# **************************************************************************

# Debian and Ubuntu based images are supported. Alpine images are not yet supported.
FROM ubuntu:bionic
FROM debian:9

# Install git, process tools
RUN apt-get update && apt-get -y install git procps
Expand Down
2 changes: 1 addition & 1 deletion container-templates/dockerfile/.devcontainer/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#-----------------------------------------------------------------------------------------

# Debian and Ubuntu based images are supported. Alpine images are not yet supported.
FROM ubuntu:bionic
FROM debian:9

# Install git, process tools
RUN apt-get update && apt-get -y install git procps
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,19 @@
# Licensed under the MIT License. See LICENSE in the project root for license information.
#-----------------------------------------------------------------------------------------

FROM python:3.7-slim
FROM python:3

# Install git, process tools
RUN apt-get update && apt-get -y install git procps

# Install Docker CE - ** COMMENT OUT IF YOU WILL ONLY RUN LOCAL OR IN AZURE **
# [Optional] Install Docker CE - Remove if you won't be doing local testing
RUN apt-get install -y apt-transport-https ca-certificates curl gnupg-agent software-properties-common \
&& curl -fsSL https://download.docker.com/linux/debian/gpg | apt-key add - \
&& add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/debian $(lsb_release -cs) stable" \
&& curl -fsSL https://download.docker.com/linux/$(lsb_release -is | tr '[:upper:]' '[:lower:]')/gpg | apt-key add - \
&& add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/$(lsb_release -is | tr '[:upper:]' '[:lower:]') $(lsb_release -cs) stable" \
&& apt-get update \
&& apt-get install -y docker-ce-cli


# Install pylint
RUN pip install pylint

Expand Down
12 changes: 7 additions & 5 deletions containers/azure-terraform/.devcontainer/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,14 @@ RUN curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.34.0/install.sh
&& nvm install lts/* \
&& nvm alias default lts/*"

# [Optional] For local testing instead of cloud shell
# Install Docker CE CLI.
RUN curl -fsSL https://download.docker.com/linux/debian/gpg | apt-key add - \
&& add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/debian $(lsb_release -cs) stable" \
RUN && curl -fsSL https://download.docker.com/linux/$(lsb_release -is | tr '[:upper:]' '[:lower:]')/gpg | apt-key add - \
&& add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/$(lsb_release -is | tr '[:upper:]' '[:lower:]') $(lsb_release -cs) stable" \
&& apt-get update \
&& apt-get install -y docker-ce-cli
&& apt-get install -y docker-ce-cli

# [Optional] For local testing instead of cloud shell
# Install the Azure CLI
RUN echo "deb [arch=amd64] https://packages.microsoft.com/repos/azure-cli/ $(lsb_release -cs) main" > /etc/apt/sources.list.d/azure-cli.list \
&& curl -L https://packages.microsoft.com/keys/microsoft.asc | apt-key add - \
Expand All @@ -39,10 +41,10 @@ RUN echo "deb [arch=amd64] https://packages.microsoft.com/repos/azure-cli/ $(ls

# Install Terraform and tflint
RUN mkdir -p /tmp/docker-downloads \
&& curl -sSL -o /tmp/docker-downloads/terraform.zip https://releases.hashicorp.com/terraform/0.11.11/terraform_0.11.11_linux_amd64.zip \
&& curl -sSL -o /tmp/docker-downloads/terraform.zip https://releases.hashicorp.com/terraform/0.11.13/terraform_0.11.13_linux_amd64.zip \
&& unzip /tmp/docker-downloads/terraform.zip \
&& mv terraform /usr/local/bin \
&& curl -sSL -o /tmp/docker-downloads/tflint.zip https://github.com/wata727/tflint/releases/download/v0.7.4/tflint_linux_amd64.zip \
&& curl -sSL -o /tmp/docker-downloads/tflint.zip https://github.com/wata727/tflint/releases/download/v0.7.5/tflint_linux_amd64.zip \
&& unzip /tmp/docker-downloads/tflint.zip \
&& mv tflint /usr/local/bin \
&& cd ~ \
Expand Down
2 changes: 1 addition & 1 deletion containers/cpp/.devcontainer/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# Licensed under the MIT License. See LICENSE in the project root for license information.
#-----------------------------------------------------------------------------------------

FROM ubuntu:bionic
FROM debian:9

# Install git, process tools
RUN apt-get update && apt-get -y install git procps
Expand Down
9 changes: 4 additions & 5 deletions containers/docker-in-docker-compose/.devcontainer/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,15 @@
#-----------------------------------------------------------------------------------------

# Note: You can use any Debian/Ubuntu based image you want.
FROM ubuntu:bionic
FROM debian:9

# Install git, process tools
RUN apt-get update && apt-get -y install git procps

# Install Docker CE CLI. If you choose a Debian based image, update https://download.docker.com/linux/ubuntu
# to https://download.docker.com/linux/debian on the third line below.
# Install Docker CE CLI
RUN apt-get install -y apt-transport-https ca-certificates curl gnupg-agent software-properties-common \
&& curl -fsSL https://download.docker.com/linux/ubuntu/gpg | apt-key add - \
&& add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" \
&& curl -fsSL https://download.docker.com/linux/$(lsb_release -is | tr '[:upper:]' '[:lower:]')/gpg | apt-key add - \
&& add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/$(lsb_release -is | tr '[:upper:]' '[:lower:]') $(lsb_release -cs) stable" \
&& apt-get update \
&& apt-get install -y docker-ce-cli

Expand Down
24 changes: 5 additions & 19 deletions containers/docker-in-docker-compose/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,41 +22,27 @@ Dev containers can be useful for all types of applications including those that

If you prefer, you can also just look through the contents of the `.devcontainer` folder to understand how to make changes to your own project.

No additional setup steps are required, but note that the included `.devcontainer/Dockerfile` can be altered to work with other Debian/Ubuntu-based container images such as `node` or `python`. First, update the `FROM` statement to reference the new base image. For example:

```Dockerfile
FROM node:8
```

Next, if you choose an image that is Debian based instead of Ubuntu, you will need to update this line...

```
&& add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" \
```

...to ...

```
&& add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/debian $(lsb_release -cs) stable" \
```

See the [Docker CE installation steps for Linux](https://docs.docker.com/install/linux/docker-ce/debian/) for details on other distributions. Note that you only need the Docker CLI in this particular case.

## How it works

The trick that makes this work is as follows:

1. First, install the Docker CLI in the container. From `dev-container.dockerfile`:
1. First, install the Docker CLI in the container. From `.devcontainer/Dockerfile`:

```Dockerfile
# Install Docker CE CLI
RUN apt-get install -y apt-transport-https ca-certificates curl gnupg-agent software-properties-common \
&& curl -fsSL https://download.docker.com/linux/ubuntu/gpg | apt-key add - \
&& add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" \
&& curl -fsSL https://download.docker.com/linux/$(lsb_release -is | tr '[:upper:]' '[:lower:]')/gpg | apt-key add - \
&& add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/$(lsb_release -is | tr '[:upper:]' '[:lower:]') $(lsb_release -cs) stable" \
&& apt-get update \
&& apt-get install -y docker-ce-cli
```
2. Then just forward the Docker socket by mounting it in the container. From `docker-compose.dev-container.yml`:

2. Then just forward the Docker socket by mounting it in the container. From `.devcontainer/docker-compose.yml`:

```yaml
volumes:
Expand Down
9 changes: 4 additions & 5 deletions containers/docker-in-docker/.devcontainer/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,15 @@
#-----------------------------------------------------------------------------------------

# Note: You can use any Debian/Ubuntu based image you want.
FROM ubuntu:bionic
FROM debian:9

# Install git, process tools
RUN apt-get update && apt-get -y install git procps

# Install Docker CE CLI. If you choose a Debian based image, update https://download.docker.com/linux/ubuntu
# to https://download.docker.com/linux/debian on the third line below.
# Install Docker CE CLI
RUN apt-get install -y apt-transport-https ca-certificates curl gnupg-agent software-properties-common \
&& curl -fsSL https://download.docker.com/linux/ubuntu/gpg | apt-key add - \
&& add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" \
&& curl -fsSL https://download.docker.com/linux/$(lsb_release -is | tr '[:upper:]' '[:lower:]')/gpg | apt-key add - \
&& add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/$(lsb_release -is | tr '[:upper:]' '[:lower:]') $(lsb_release -cs) stable" \
&& apt-get update \
&& apt-get install -y docker-ce-cli

Expand Down
22 changes: 6 additions & 16 deletions containers/docker-in-docker/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,35 +28,25 @@ No additional setup steps are required, but note that the included `.devcontaine
FROM node:8
```

Next, if you choose an image that is Debian based instead of Ubuntu, you will need to update this line...

```
&& add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" \
```

...to ...

```
&& add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/debian $(lsb_release -cs) stable" \
```

See the [Docker CE installation steps for Linux](https://docs.docker.com/install/linux/docker-ce/debian/) for details on other distributions. Note that you only need the Docker CLI in this particular case.

## How it works

The trick that makes this work is as follows:

1. First, install the Docker CLI in the container. From `dev-container.dockerfile`:
1. First, install the Docker CLI in the container. From `.devcontainer/Dockerfile`:

```Dockerfile
# Install Docker CE CLI
RUN apt-get install -y apt-transport-https ca-certificates curl gnupg-agent software-properties-common \
&& curl -fsSL https://download.docker.com/linux/ubuntu/gpg | apt-key add - \
&& add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" \
&& curl -fsSL https://download.docker.com/linux/$(lsb_release -is | tr '[:upper:]' '[:lower:]')/gpg | apt-key add - \
&& add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/$(lsb_release -is | tr '[:upper:]' '[:lower:]') $(lsb_release -cs) stable" \
&& apt-get update \
&& apt-get install -y docker-ce-cli

```
2. Then just forward the Docker socket by mounting it in the container. From `devContainer.json`:

2. Then just forward the Docker socket by mounting it in the container. From `.devcontainer/devcontainer.json`:

```json
"runArgs": ["-v","/var/run/docker.sock:/var/run/docker.sock"]
Expand Down
4 changes: 2 additions & 2 deletions containers/javascript-node-8/.devcontainer/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ RUN apt-get update && apt-get -y install git procps

# Install yarn
RUN apt-get install -y curl apt-transport-https \
&& curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - \
&& echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list \
&& curl -sS https://dl.yarnpkg.com/$(lsb_release -is | tr '[:upper:]' '[:lower:]')/pubkey.gpg | apt-key add - \
&& echo "deb https://dl.yarnpkg.com/$(lsb_release -is | tr '[:upper:]' '[:lower:]')/ stable main" | tee /etc/apt/sources.list.d/yarn.list \
&& apt-get update \
&& apt-get install -y yarn

Expand Down
4 changes: 2 additions & 2 deletions containers/javascript-node-lts-mongo/.devcontainer/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ RUN apt-get update && apt-get -y install git procps

# Install yarn
RUN apt-get install -y curl apt-transport-https \
&& curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - \
&& echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list \
&& curl -sS https://dl.yarnpkg.com/$(lsb_release -is | tr '[:upper:]' '[:lower:]')/pubkey.gpg | apt-key add - \
&& echo "deb https://dl.yarnpkg.com/$(lsb_release -is | tr '[:upper:]' '[:lower:]')/ stable main" | tee /etc/apt/sources.list.d/yarn.list \
&& apt-get update \
&& apt-get install -y yarn

Expand Down
4 changes: 2 additions & 2 deletions containers/javascript-node-lts/.devcontainer/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ RUN apt-get update && apt-get -y install git procps

# Install yarn
RUN apt-get install -y curl apt-transport-https \
&& curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - \
&& echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list \
&& curl -sS https://dl.yarnpkg.com/$(lsb_release -is | tr '[:upper:]' '[:lower:]')/pubkey.gpg | apt-key add - \
&& echo "deb https://dl.yarnpkg.com/$(lsb_release -is | tr '[:upper:]' '[:lower:]')/ stable main" | tee /etc/apt/sources.list.d/yarn.list \
&& apt-get update \
&& apt-get install -y yarn

Expand Down
12 changes: 6 additions & 6 deletions containers/kubernetes-helm/.devcontainer/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,23 @@
# Licensed under the MIT License. See LICENSE in the project root for license information.
#-----------------------------------------------------------------------------------------

FROM ubuntu:bionic
# You can use any Debian/Ubuntu based image as abase
FROM debian:9

# Install git, process tools
RUN apt-get update && apt-get -y install git procps


# Install Docker CE CLI. If you choose a Debian based image, update https://download.docker.com/linux/ubuntu
# to https://download.docker.com/linux/debian on the third line below.
# Install Docker CE CLI
RUN apt-get install -y apt-transport-https ca-certificates curl gnupg-agent software-properties-common \
&& curl -fsSL https://download.docker.com/linux/ubuntu/gpg | apt-key add - \
&& add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" \
&& curl -fsSL https://download.docker.com/linux/$(lsb_release -is | tr '[:upper:]' '[:lower:]')/gpg | apt-key add - \
&& add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/$(lsb_release -is | tr '[:upper:]' '[:lower:]') $(lsb_release -cs) stable" \
&& apt-get update \
&& apt-get install -y docker-ce-cli

# Install kubectl
RUN curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key add - \
&& echo "deb https://apt.kubernetes.io/ kubernetes-xenial main" | tee -a /etc/apt/sources.list.d/kubernetes.list \
&& echo "deb https://apt.kubernetes.io/ kubernetes-$(lsb_release -cs) main" | tee -a /etc/apt/sources.list.d/kubernetes.list \
&& apt-get update \
&& apt-get install -y kubectl

Expand Down
16 changes: 9 additions & 7 deletions containers/kubernetes-helm/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@ To get started, follow the appropriate steps below for your operating system.

First, install the **[Visual Studio Code Remote Development](https://aka.ms/vscode-remote/download/extension)** extension pack if you have not already.

To try out the definition with an existing project, copy the `.devcontainer` folder into your project root and then follow the OS specific directions below.
To try out the definition with an existing project, copy the `.devcontainer` folder into your project root and then follow the OS specific directions below.

> **Note:** If you want to disable sync'ing local Kubernetes config into the container, remove `"-e", "SYNC_LOCALHOST_KUBECONFIG=true",` from `runArgs` in `.devcontainer/devcontainer.json`.
### macOS / Windows Setup

Expand Down Expand Up @@ -62,35 +64,35 @@ To try out the definition with an existing project, copy the `.devcontainer` f

The trick that makes this work is as follows:

1. First, install all of the needed CLIs in the container. From `dev-container.dockerfile`:
1. First, install all of the needed CLIs in the container. From `.devcontainer/Dockerfile`:

```Dockerfile
# Install Docker CE CLI
RUN apt-get install -y apt-transport-https ca-certificates curl gnupg-agent software-properties-common \
&& curl -fsSL https://download.docker.com/linux/ubuntu/gpg | apt-key add - \
&& add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" \
&& curl -fsSL https://download.docker.com/linux/$(lsb_release -is | tr '[:upper:]' '[:lower:]')/gpg | apt-key add - \
&& add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/$(lsb_release -is | tr '[:upper:]' '[:lower:]') $(lsb_release -cs) stable" \
&& apt-get update \
&& apt-get install -y docker-ce-cli

# Install kubectl
RUN curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key add - \
&& echo "deb https://apt.kubernetes.io/ kubernetes-xenial main" | tee -a /etc/apt/sources.list.d/kubernetes.list \
&& echo "deb https://apt.kubernetes.io/ kubernetes-$(lsb_release -cs) main" | tee -a /etc/apt/sources.list.d/kubernetes.list \
&& apt-get update \
&& apt-get install -y kubectl

# Install Helm
RUN curl -s https://raw.githubusercontent.com/helm/helm/master/scripts/get | bash -
```

2. Next, forward the local Docker socket and mount the local `.kube` folder in the container so the configuration can be reused. From `devContainer.json`:
2. Next, forward the local Docker socket and mount the local `.kube` folder in the container so the configuration can be reused. From `.devcontainer/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. Finally, update `.bashrc` to automatically swap out localhost for host.docker.internal in a containr copy of the Kubernetes config. From `dev-container.dockerfile`:
3. Finally, update `.bashrc` to automatically swap out localhost for host.docker.internal in a containr copy of the Kubernetes config. From `.devcontainer/Dockerfile`:

```Dockerfile
RUN echo 'if [ "$SYNC_LOCALHOST_KUBECONFIG" == "true" ]; then \
Expand Down
2 changes: 1 addition & 1 deletion containers/markdown/.devcontainer/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# Licensed under the MIT License. See LICENSE in the project root for license information.
#-----------------------------------------------------------------------------------------

FROM ubuntu:bionic
FROM debian:9

# Install git, process tools
RUN apt-get update && apt-get -y install git procps
Expand Down
4 changes: 2 additions & 2 deletions containers/typescript-node-8/.devcontainer/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ RUN apt-get update && apt-get -y install git procps

# Install yarn
RUN apt-get install -y apt-transport-https \
&& curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - \
&& echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list \
&& curl -sS https://dl.yarnpkg.com/$(lsb_release -is | tr '[:upper:]' '[:lower:]')/pubkey.gpg | apt-key add - \
&& echo "deb https://dl.yarnpkg.com/$(lsb_release -is | tr '[:upper:]' '[:lower:]')/ stable main" | tee /etc/apt/sources.list.d/yarn.list \
&& apt-get update \
&& apt-get install -y yarn

Expand Down
Loading

0 comments on commit 69b93b6

Please sign in to comment.