> For the complete documentation index, see [llms.txt](https://developer.harness.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://developer.harness.io/open-source/use-harness-open-source/gitspaces/get-started/gitspace-configuration.md).

# Gitspace Configuration

This guide will walk you through the Gitspace configuration in detail.

Each time a new Gitspace is created, a dedicated Development Container is provisioned on a separate Virtual Machine (VM), providing an isolated and secure development environment.

This Development Container allows you to work within a containerized version of a build environment. Simply put, it offers a pre-configured, ready-to-code setup directly within your IDE, allowing you to start coding instantly.

<img src="https://github.com/user-attachments/assets/0ca2d223-0cee-4ab6-aaa5-5752549eb263" alt="gitspace config" width="900">

#### Development Containers <a href="#development-containers" id="development-containers"></a>

Development Containers (also known as [Dev Containers](https://containers.dev/implementors/spec/)) are an open source specification for developing consistent and feature-rich development environments.

This specification equips containers with all the tools, libraries and runtimes required to enable seamless development inside them. The development environment is configured based on metadata defined in this specification. Each Development Container is defined by a `devcontainer.json` file, which configures the containerized development environment.

#### devcontainer.json File <a href="#devcontainerjson-file" id="devcontainerjson-file"></a>

Gitspace configuration lives with your source code in the `.devcontainer/devcontainer.json` file within your project’s repository. This file contains all necessary metadata and settings to define your development environment.

The `devcontainer.json` specification includes various properties, allowing you to customize the environment.

Currently, we support the following properties in a `devcontainer.json` file: (additional properties coming soon, read more about the [devcontainer metadata reference](https://containers.dev/implementors/json_reference/) here)

| **Argument**                                                                                           | **Usage**                                                                                                                                                             |
| ------------------------------------------------------------------------------------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `image`                                                                                                | Image used to create the container                                                                                                                                    |
| [`forwardPorts`](/open-source/use-harness-open-source/gitspaces/develop-in-gitspaces/forward-ports.md) | Array of ports to be forwarded from the Gitspace to the local machine (including inside the web)                                                                      |
| `postCreateCommand`                                                                                    | Command to be executed after the Gitspace is created                                                                                                                  |
| `postStartCommand`                                                                                     | Command to be executed after the Gitspace is started                                                                                                                  |
| [`runArgs`](/open-source/use-harness-open-source/gitspaces/develop-in-gitspaces/runargs.md)            | Array of Docker CLI arguments to be used when running the Gitspace                                                                                                    |
| [`containerEnv`](/open-source/use-harness-open-source/gitspaces/develop-in-gitspaces/env-variables.md) | Name-value pairs that sets/overrides environment variables for the container                                                                                          |
| [`containerUser`](/open-source/use-harness-open-source/gitspaces/develop-in-gitspaces/user-config.md)  | Defines the user for all operations run as inside the container                                                                                                       |
| [`remoteUser`](/open-source/use-harness-open-source/gitspaces/develop-in-gitspaces/user-config.md)     | Defines the user that devcontainer.json supporting services tools / runs as in the container (including lifecycle scripts and any remote editor/IDE server processes) |
| [`extensions`](/open-source/use-harness-open-source/gitspaces/develop-in-gitspaces/extensions.md)      | Array of extension IDs that specifies which extensions should be installed when the Gitspace is created                                                               |

The path for this configuration file is `.devcontainer/devcontainer.json`

#### Example devcontainer.json File <a href="#example-devcontainerjson-file" id="example-devcontainerjson-file"></a>

```
{
    "image": "mcr.microsoft.com/devcontainers/javascript-node:1-18-bullseye",
    "forwardPorts": [9000],
    "postCreateCommand": "yarn install",
    "postStartCommand": "npm install",
    "containerEnv": {
            "MY_CONTAINER_VAR": "abcd",
            "MY_CONTAINER_VAR2": "efgh"
    },
    "vscode": {
      "extensions": ["streetsidesoftware.code-spell-checker"]
    },
    "runArgs": ["--restart=no", "--security-opt", "seccomp=unconfined"],
    "containerUser": "root",
    "remoteUser": "vscode"
}
```

#### Default Image <a href="#default-image" id="default-image"></a>

You can specify the image required to create the container in the `devcontainer.json` file. Any necessary application dependencies can be pre-installed in this image to save setup time.

If a repository does not have a `devcontainer.json`, we will spin up the CDE with a default docker image at `mcr.microsoft.com/devcontainers/base:dev-ubuntu-24.04`. The Dockerfile for this default image is available at [default image](https://github.com/devcontainers/images/tree/main/src/base-ubuntu).
