Skip to content

Using with an Existing Magento Project

If you already have a Magento project with a composer.json, follow these steps to add the devcontainer.

Prerequisites

Steps

  1. Add the devcontainer as a submodule:
bash
mkdir -p .devcontainer
git submodule add https://github.com/graycoreio/magento2-devcontainer.git .devcontainer/magento2-devcontainer
  1. Run the init script:
bash
.devcontainer/magento2-devcontainer/bin/init.sh

The script auto-detects your Magento version from composer.json and generates the devcontainer configuration.

  1. Open in VS Code and click Reopen in Container when prompted.

  2. Install dependencies and run setup:

bash
composer install
.devcontainer/magento2-devcontainer/bin/setup-install.sh | bash
  1. Verify the installation:
bash
bin/magento --version

Next Steps