{"id":48671150,"url":"https://github.com/devcontainer-env/devcontainer-env","last_synced_at":"2026-05-24T04:01:06.052Z","repository":{"id":350130694,"uuid":"1179785154","full_name":"devcontainer-env/devcontainer-env","owner":"devcontainer-env","description":"A developer CLI that bridges devcontainers and the host environment — run host commands with devcontainer service environments and automatically rewrite container service URLs to host ports.","archived":false,"fork":false,"pushed_at":"2026-05-17T05:11:26.000Z","size":271,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-05-17T07:25:14.600Z","etag":null,"topics":["devcontainer","developer-tools","development-environment","development-workflow","docker","docker-compose","rust"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/devcontainer-env.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-03-12T11:30:36.000Z","updated_at":"2026-05-17T05:11:29.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/devcontainer-env/devcontainer-env","commit_stats":null,"previous_names":["devcontainer-env/devcontainer-env"],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/devcontainer-env/devcontainer-env","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devcontainer-env%2Fdevcontainer-env","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devcontainer-env%2Fdevcontainer-env/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devcontainer-env%2Fdevcontainer-env/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devcontainer-env%2Fdevcontainer-env/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/devcontainer-env","download_url":"https://codeload.github.com/devcontainer-env/devcontainer-env/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devcontainer-env%2Fdevcontainer-env/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33420660,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-23T22:14:44.296Z","status":"online","status_checked_at":"2026-05-24T02:00:06.296Z","response_time":57,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["devcontainer","developer-tools","development-environment","development-workflow","docker","docker-compose","rust"],"created_at":"2026-04-10T12:10:41.868Z","updated_at":"2026-05-24T04:01:06.044Z","avatar_url":"https://github.com/devcontainer-env.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# devcontainer-env\n\n\u003e Bridge devcontainers and the host environment — run host commands with devcontainer service environments and automatically rewrite container service URLs to host ports.\n\n[![CI](https://github.com/devcontainer-env/devcontainer-env/actions/workflows/ci.yml/badge.svg)](https://github.com/devcontainer-env/devcontainer-env/actions/workflows/ci.yml)\n[![Release](https://img.shields.io/github/v/release/devcontainer-env/devcontainer-env)](https://github.com/devcontainer-env/devcontainer-env/releases/latest)\n[![Crate](https://img.shields.io/crates/v/devcontainer-env)](https://crates.io/crates/devcontainer-env)\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](LICENSE)\n\n![Demo](doc/tapes/output/demo.webp)\n\n## Installation\n\n### Cargo (Crates.io)\n\n```bash\ncargo install devcontainer-env\n```\n\n### Nix (recommended)\n\nRun directly without installing:\n\n```bash\nnix run github:devcontainer-env/devcontainer-env -- exec -- your-command\n```\n\nOr install into your profile:\n\n```bash\nnix profile install github:devcontainer-env/devcontainer-env\n```\n\n## Usage\n\n```\nUsage: devcontainer-env \u003cCOMMAND\u003e\n\nCommands:\n  inspect  Inspect and display the devcontainer environment configuration and service port mappings.\n  export   Export devcontainer service environment variables with container URLs rewritten to host ports.\n  exec     Execute a host command with the devcontainer service environment applied, rewriting container URLs to host ports.\n  help     Print this message or the help of the given subcommand(s)\n\nOptions:\n  -h, --help     Print help\n  -V, --version  Print version\n```\n\n**devcontainer-env export** — Output environment variables from `containerEnv` as shell statements.\n\nOnly variables defined in the `containerEnv` section are exported to the host (not service configuration or service environment variables). See [Configuration](#configuration) for an example.\n\n```bash\n$ devcontainer-env export\n```\n\n```bash\nexport EXAMPLE_API_DATABASE_URL=postgres://vscode@127.0.0.1:32771/example-db?sslmode=disable\n```\n\n**devcontainer-env exec** — Run a command with devcontainer environment available:\n\n```bash\ndevcontainer-env exec -- \u003cCOMMAND\u003e [ARGS...]\n```\n\nThe `--` separator is required. Everything after `--` is passed to the command.\n\n**devcontainer-env inspect** — Parse and display the devcontainer configuration:\n\n```bash\n$ devcontainer-env inspect\n```\n\n```bash\nWorkspace: /Users/iamralch/Projects/github.com/devcontainer-env/devcontainer-env/example\n\nContainers:\n  example_devcontainer-postgres-1\n    Image: postgres:18-bookworm\n    Hosts: example_devcontainer-postgres-1, postgres, 3dac21f544da\n    Ports: 5432 → 0.0.0.0:32771, 5432 → :::32771\n\n  example_devcontainer-workspace-1, main\n    Image: mcr.microsoft.com/devcontainers/base:noble\n    Hosts: example_devcontainer-workspace-1, workspace, 742062d03e2e\n\nEnvironment:\n  EXAMPLE_API_DATABASE_URL = postgres://vscode@127.0.0.1:32771/example-db?sslmode=disable\n```\n\n## Configuration\n\nSee the [`example/`](./example) directory for a complete working configuration.\n\n### Variable Exporting\n\nDevContainer supports two ways to define environment variables: `containerEnv` and `remoteEnv`. **`devcontainer-env` works exclusively with `containerEnv`.** Variables in `containerEnv` are set when the container starts and apply to all processes. Variables in `remoteEnv` are set specifically for the VS Code server process and its sub-processes (terminals, tasks) — they can be updated without rebuilding the container but do not apply to background daemons. Use `containerEnv` for any variables you want accessible on the host (connection strings, API endpoints, service URLs).\n\n### Port Mapping\n\nUse `ports: [\u003cPORT\u003e]` syntax (not `\"HOST:PORT\"`) to let Docker assign random available host ports. This prevents conflicts when running multiple devcontainers or projects simultaneously. `devcontainer-env export` automatically detects the Docker-assigned host port and makes it available in exported environment variables. Do not use `forwardPorts` in `devcontainer.json` — rely on `docker-compose.yml` port mapping instead.\n\n## License\n\n[MIT](LICENSE) — Copyright (c) 2025 devcontainer-env\n\n\u003c!-- markdownlint-disable-file MD013 --\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdevcontainer-env%2Fdevcontainer-env","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdevcontainer-env%2Fdevcontainer-env","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdevcontainer-env%2Fdevcontainer-env/lists"}