# atmos devcontainer attach

Use this command to attach to a running devcontainer and get an interactive shell. If the container is not running, it will be started automatically.

## Usage

```shell
atmos devcontainer attach <name> [flags]
```

## Arguments

- **`name`** — Name of the devcontainer to attach to

## Flags

- **`--instance string`** — Instance name for this devcontainer (default: `default`)

## Examples

```shell
# Attach to a devcontainer
atmos devcontainer attach geodesic

# Attach to a specific instance
atmos devcontainer attach terraform --instance project-a
```

## Behavior

- Opens an interactive shell (`/bin/bash` by default) in the container
- Uses login shell (`-l` flag) if `userEnvProbe` is set to `loginShell` or `loginInteractiveShell` in the devcontainer configuration
- Automatically starts the container if it's not running
- Inherits your terminal size and supports full TTY features

## Try it out

### devcontainer

Copy the example into a new directory and make it your own:

```shell
atmos init examples/devcontainer
cd devcontainer
```

Requires a running Podman runtime (the example selects Podman) and network access for the image. Exit the attached shell before running the cleanup commands.

```shell
atmos devcontainer start geodesic
atmos devcontainer attach geodesic
atmos devcontainer stop geodesic
atmos devcontainer remove geodesic
```

- [Installation guide](/install)
- [Explore the example](/examples/devcontainer)
- [Initialization and repository settings](/cli/commands/init#examples-and-source-directories)

## See Also

- [`atmos devcontainer start`](/cli/commands/devcontainer/start)
- [`atmos devcontainer exec`](/cli/commands/devcontainer/exec)
