You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Nov 30, 2023. It is now read-only.
RUN curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key add - 2>/dev/null \
37
-
&& echo "deb https://apt.kubernetes.io/ kubernetes-$(lsb_release -cs) main" | tee -a /etc/apt/sources.list.d/kubernetes.list \
38
-
&& apt-get update \
39
-
&& apt-get install -y kubectl
40
-
41
-
# Install Helm
42
-
RUN curl -s https://raw.githubusercontent.com/helm/helm/master/scripts/get | bash -
43
-
```
44
-
45
-
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`:
25
+
1. First, update your `devcontainer.json` to forward the local Docker socket and mount the local `.kube` folder in the container so its contents can be reused. From `.devcontainer/devcontainer.json`:
3. Update `.bashrc` to automatically swap out `localhost` for `host.docker.internal` in the container's copy of the Kubernetes config and (optionally) Minikube certificates. From `.devcontainer/Dockerfile`:
41
+
42
+
2. Second, update your Dockerfile so the default shell is `bash`, and update the `.bashrc` script to automatically swap out `localhost` for `host.docker.internal` in the container's copy of the Kubernetes config and (optionally) Minikube certificates. From `.devcontainer/Dockerfile`:
63
43
64
44
```Dockerfile
45
+
ENV SHELL /bin/bash
46
+
65
47
RUN echo '\n\
66
48
if [ "$SYNC_LOCALHOST_KUBECONFIG" == "true" ]; then\n\
67
49
mkdir -p $HOME/.kube\n\
@@ -78,10 +60,30 @@ You can adapt your own existing development container Dockerfile to support this
78
60
sed -i -r "s|(\s*client-key:\s).*|\\1$HOME\/.minikube\/client.key|g" $HOME/.kube/config\n\
79
61
fi\n\
80
62
fi' \
81
-
>> $HOME/.bashrc
63
+
>> $HOME/.bashrc
64
+
```
65
+
66
+
3. Next, update your Dockerfile to install all of the needed CLIs in the container. From `.devcontainer/Dockerfile`:
RUN curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key add - 2>/dev/null \
78
+
&& echo "deb https://apt.kubernetes.io/ kubernetes-$(lsb_release -cs) main" | tee -a /etc/apt/sources.list.d/kubernetes.list \
79
+
&& apt-get update \
80
+
&& apt-get install -y kubectl
81
+
82
+
# Install Helm
83
+
RUN curl -s https://raw.githubusercontent.com/helm/helm/master/scripts/get | bash -
82
84
```
83
85
84
-
5. Add a container specific user settings file that forces the Docker extension to be installed inside the container instead of locally. From `.devcontainer/Dockerfile`:
86
+
4. Finally, have your Dockerfile add a container specific user settings file that forces the Docker extension to be installed inside the container instead of locally. From `.devcontainer/Dockerfile`:
@@ -97,23 +99,31 @@ You can adapt your own existing development container Dockerfile to support this
97
99
}
98
100
```
99
101
100
-
6. Press <kbd>F1</kbd> and run **Remote-Containers: Rebuild Container** so the changes take effect.
102
+
5. Press <kbd>F1</kbd> and run **Remote-Containers: Rebuild Container** so the changes take effect.
101
103
102
104
That's it!
103
105
104
106
## Using this definition with an existing folder
105
107
106
-
There are no special 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`. Just, update the `FROM` statement to reference the new base image. For example:
108
+
A few notes on the definition:
109
+
110
+
* The included `.devcontainer/Dockerfile` can be altered to work with other Debian/Ubuntu-based container images such as `node` or `python`. Just, update the `FROM` statement to reference the new base image. For example:
107
111
108
-
```Dockerfile
109
-
FROM node:lts
110
-
```
112
+
```Dockerfile
113
+
FROM node:lts
114
+
```
115
+
116
+
* If you also want to sync your Minikube certificates, open `.devcontainer/devcontainer.json` and uncomment this line in `runArgs`:
111
117
112
-
In addition, 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`.
* If you want to **disable sync'ing** local Kubernetes config / Minikube certs into the container, remove `"-e", "SYNC_LOCALHOST_KUBECONFIG=true",` from `runArgs` in `.devcontainer/devcontainer.json`.
113
123
114
-
Follow the steps below for your operating system to use the definition.
124
+
See the section below for your operating system for more detailed setup instructions.
115
125
116
-
### macOS / Windows
126
+
### Windows / macOS
117
127
118
128
1. If this is your first time using a development container, please follow the [getting started steps](https://aka.ms/vscode-remote/containers/getting-started) to set up your machine.
119
129
@@ -164,10 +174,10 @@ Follow the steps below for your operating system to use the definition.
164
174
165
175
6. After following step 2 or 3, the contents of the `.devcontainer` folder in your project can be adapted to meet your needs.
166
176
167
-
7. Open `.devcontainer/devcontainer.json` and uncomment/add this line to `runArgs` array:
177
+
7. Open `.devcontainer/devcontainer.json` and uncomment this line in the `runArgs` array:
0 commit comments