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
- VS Code with the Dev Containers extension
- Docker
Steps
- Add the devcontainer as a submodule:
bash
mkdir -p .devcontainer
git submodule add https://github.com/graycoreio/magento2-devcontainer.git .devcontainer/magento2-devcontainer- Run the init script:
bash
.devcontainer/magento2-devcontainer/bin/init.shThe script auto-detects your Magento version from composer.json and generates the devcontainer configuration.
Open in VS Code and click Reopen in Container when prompted.
Install dependencies and run setup:
bash
composer install
.devcontainer/magento2-devcontainer/bin/setup-install.sh | bash- Verify the installation:
bash
bin/magento --versionNext Steps
- Docker Compose Configuration - Customize your environment
- TLS Setup - Enable HTTPS for local development