---
title: "Container Spaces"
description: "Creating Container Spaces"
canonical_url: "https://docs.pairspaces.com/spaces/new/container"
markdown_url: "https://docs.pairspaces.com/spaces/new/container.md"
content_type: "documentation"
---

# Container Spaces

Creating Container Spaces

You create Container Spaces using your preferred hosted development environment.

## Dev Containers

[Dev Containers](https://containers.dev) is an open specification for defining coding environments.

We used [GitHub Codespaces](https://github.com/features/codespaces) to develop this approach. This approach should be general enough to work elsewhere, but contact us (support at pairspaces dot com) if you experience challenges using PairSpaces with your Dev Container.

1. Create a Codespace Secret to store your Space Key. Use the GitHub CLI:

```sh
gh secret set PS_SPACE_KEY --app codespaces --repos OWNER/REPO
```

Alternatively, you can use the GitHub UI:

- Go to GitHub Settings.

- Open Codespaces.

- Open Codespaces secrets.

- Create a secret named `PS_SPACE_KEY`.

- Paste the Space Key and grant access to the repository.

2. Include our public Dev Container Feature in your `.devcontainer.json` file.

```json
{
  ...,
  "features": {
    "ghcr.io/pairspaces/devcontainers/pairspaces": {}
  },
  "postAttachCommand": "/opt/pair/pair spaces create",
  "remoteUser": "root",
  ...
}
```

After you create your Codespace, the Dev Container feature will complete in a few seconds in a separate terminal.

![Codespaces terminal showing the PairSpaces Dev Container feature creating a Space successfully](https://docs.pairspaces.com/static/spaces-devcontainer-bootstrap.png)
