This topic tells you about using development containers (sometimes shortened to dev containers) to make a ready-to-code development environment. This enables you to connect to a pre-configured development container that includes all Tanzu tools and IDE extensions required for development on Tanzu pre-installed.
CautionSupport for development containers is in alpha testing. It is intended for evaluation and test purposes only.
A development container enables you to use a container as a full-featured development environment. You can use it to:
For more information, see the Development Containers documentation.
Obtain the following:
You can start a new project with support for development containers or you can add support for development containers to an existing project:
devcontainer
to connect to the development container.devcontainer
.tanzu devcontainer
and press Enter..devcontainer.json
.devcontainer
to connect to the development container.When you start working in your development container for the first time, you must log in and connect to your Tanzu Kubernetes cluster. The method for doing so depends on your cloud provider. For example, for Google Cloud you might run a command similar to:
gcloud container clusters get-credentials ${your_cluster_name} --region ${your_region} \
--project ${your_google_cloud_project_name}
For how to connect to a cluster, see the documentation for your specific cloud provider. Examples:
After you log in to the cluster, restart the IDE for it to detect the new cluster connection. Press CTRL+SHIFT+P (CMD+SHIFT+P on macOS) and click Developer: Reload Window in the command palette.
You are now ready to start working on your code, deploy it to your cluster, and monitor your workloads in the Tanzu Panel. To continue your development with Tanzu Developer Tools for VS Code, see Use Tanzu Developer Tools for VS Code.
Use the mounts
property in the .devcontainer.json
file to add a volume bound to any local directory. This is useful for sharing your Kubernetes cluster credentials with the development container, such as a macOS or Linux host.
For example:
"mounts": [
"source=${localEnv:HOME}/.kube/,target=/home/vscode/.kube/,type=bind,consistency=cached"
],
For more information about using mounts with development containers, see the Visual Studio Code documentation.
When the devcontainer
is created for the first time you are prompted to review and agree with the VMware General Terms and to participate in the Customer Experience Improvement Program (CEIP).
The selections you make are stored and you will not prompted again when you next start devcontainer
.