DEV Community

Fabian Jevon
Fabian Jevon

Posted on

4 1 1 1 1

How to generate devcontainer.json automatically without using devcontainer.ai

I want to share my troubleshooting experience when creating a sample project for https://www.daytona.io/.

Problem Background

I need a valid devcontainer.json to run daytona properly but I don't have experience in writing devcontainer configuration & (in that moment) https://devcontainer.ai/ can't generate one for me.

The Solution

I found the alternative way to generate it using VSCode IDE.

  1. Install VSCode Plugin named Dev Containers Image description
  2. Open Command Palette (default shortcut: Ctrl+shift+P)
  3. Search for Dev Containers: Add Dev Container Configuration Files then select it Image description
  4. Choose Add configuration to workspace Image description
  5. Choose the configuration template. In my case, because I'm building a project using Laravel, I choose PHP for the configuration template then choose the default for the PHP version. Image description Image description
  6. Choose the additional features to install. In my case, I need Node.js (via NPM) installed to support my Laravel project then keep defaults Image description
  7. Choose optional File / directories. In my case, I don't need additional file / directories Image description
  8. And.. Voila! A fresh devcontainer.json has been generated for you. Image description

I found this method is very beginner friendly to those who don't have experience in writing devcontainer configuration because the generated config file has several informative comments in it so it can help us learn

Image of Stellar post

From Hackathon to Funded - Stellar Dev Diaries Ep. 1 🎥

Ever wondered what it takes to go from idea to funding? In episode 1 of the Stellar Dev Diaries, we hear how the Freelii team did just that. Check it out and follow along to see the rest of their dev journey!

Watch the video

Top comments (2)

Collapse
 
betterslip profile image
BetterSlip

Good post!

Collapse
 
tryxns profile image
Fabian Jevon

thanks!

Image of Stellar post

Check out Episode 1: How a Hackathon Project Became a Web3 Startup 🚀

Ever wondered what it takes to build a web3 startup from scratch? In the Stellar Dev Diaries series, we follow the journey of a team of developers building on the Stellar Network as they go from hackathon win to getting funded and launching on mainnet.

Read more

👋 Kindness is contagious

Engage with a wealth of insights in this thoughtful article, cherished by the supportive DEV Community. Coders of every background are encouraged to bring their perspectives and bolster our collective wisdom.

A sincere “thank you” often brightens someone’s day—share yours in the comments below!

On DEV, the act of sharing knowledge eases our journey and forges stronger community ties. Found value in this? A quick thank-you to the author can make a world of difference.

Okay