A development container is a running Docker container with a well-defined tool/runtime stack and its prerequisites. You can try out development containers with GitHub Codespaces or Visual Studio Code Remote - Containers.
This is a template project for Ballerina language with VS Code development containers.
Follow these steps to open this sample in a Codespace:
- Click the Code drop-down menu and select the Open with Codespaces option.
- Select + New codespace at the bottom on the pane.
For more info, check out the GitHub documentation.
Follow these steps to open this sample in a container using the VS Code Remote - Containers extension:
-
If this is your first time using a development container, please ensure your system meets the pre-reqs (i.e. have Docker installed) in the getting started steps.
-
Use this template repository to create a Ballerina project repository
-
Clone the newly created repository to your local filesystem.
-
Press F1 and select the Remote-Containers: Open Folder in Container... command.
-
Select the cloned copy of this folder, wait for the container to start, and try things out!
To create a Ballerina project open up the terminal in VSCode (Terminal -> New Terminal
). Then use the following command to create your Ballerina project.
$ bal init
Create a Ballerina module with
$ bal add <module_name>
Update the .devcontainer/devcontainer.json file to switch the Ballerina version of the container
{
"name": "Ubuntu",
"build": {
"dockerfile": "Dockerfile",
"args": { "VARIANT": "<IMAGE_TAG_GOES_HERE>" }
},
...
You can check the docker hub ballerina-dev registry for released Ballerina dev containers.
NOTE: Base docker image for the dev container is maintained at VS Code Remote Ballerina-Dev Docker repository.