Docker

Setting up a Developer Environment Using Docker

Docker is one of the frequently used tools for managing, building, and deploying DevOps projects. To get started with the Docker tool, users are required to set the developer environment to start building or deploying the app. For this purpose, you can set up a Git repository, Git branch, or any local repository to start building an app.

This post will demonstrate how to set up a developer environment using Docker.

Pre-requisites: Install Docker, WSL Package, and Visual Studio Code

For setting up a development environment using Docker, the developers are required to install Docker, the WSL package updater, and the Visual Studio code editor for building and deploying projects:

  • To install the Docker Desktop on Windows, navigate to its official website.
  • To install the WSL package updater, open the attached link.
  • In order to install the Visual Studio Code editor, open its official website and download the Visual Studio stable version. Docker develops and deploys applications using the Visual Studio coding editor.

Note: After installing the Visual Studio code editor, users are required to install Docker extensions in the editor.

How to Set a Developer Environment Using Docker?

The “Dev Environments” is a major component of Docker that is utilized to configure the developer environment with all code dependencies and the required tool to start application deployment.

To configure the Developer environment, go through the given instructions.

Step 1: Open Docker
First, launch the Docker Desktop application from the Start menu:

Step 2: Open Docker Desktop Settings
Next, navigate to the Docker System Settings by clicking on highlighted “Gear” icon:

Step 3: Check WSL Integration is Enabled
From the Docker settings, click on “Resources”, then navigate to the “WSL integration” settings. Check whether the WSL integration is enabled or not. If the WSL integration is not enabled, try to enable it:

Step 4: Create Dev Environment
In the next step, open the “Dev Environment” menu from the Docker dashboard. Hit the “Create a new environment” button to create a new developer environment:

Step 5: Set Developer Environment
Upon doing so, the “Create a Dev Environment” window will appear on the screen. Set the name of the environment and choose your source. Here, users can add an existing Git repository or any local directory.

For instance, we have selected the “Local directory” as a source. After that, select the directory path using the “Start” button:

Next, select the local directory and hit the “Select Folder” button:

After selecting the local directory path, press the “Continue” button:

Setting up the developer environment will take some time. After that, press the “Continue” button to start working:

The below output indicates that we have successfully created and configured the developer environment using Docker:

Step 6: Open the PowerShell Terminal
Now, open the Windows PowerShell terminal from the “Startup” menu:

Step 7: Verify if Developer Environment is Set
Verify whether you have configured the development environment or not by viewing the Docker container list:

> docker container ls

It can be observed that we have a new container named “git_local_repository-app-1”:

To run the container, the user can utilize the “docker run” command:

> docker run --rm -it docker/dev-environments-default:stable-1

Alternatively, users can view the container through the Visual Studio Code editor by launching it from the Start menu:

Here, you can see the list of containers in the Visual Studio Code editor:

We have elaborated on how to set up a developer environment using Docker.

Conclusion

To set up a developer environment using Docker, users are required to fulfill some prerequisites, such as installing Docker, WSL package updater, and VS code. After that, open the Docker application, and navigate the “Dev Environments” menu to create a new environment. Set the environment name, source, and directory path to configure the developer environment. We have demonstrated how to set up a developer environment using Docker.

About the author

Rafia Zafar

I am graduated in computer science. I am a junior technical author here and passionate about Programming and learning new technologies. I have worked in JAVA, HTML 5, CSS3, Bootstrap, and PHP.