Creating a programming environment in a Docker container

Tram Ho

Hi everyone, I don’t know if everyone is using the following way to create a programming environment, or is there a better way, so I’m writing this article to share how I’m doing now. Talking about myself first, I am a person who likes to learn widely, wants to learn many things to have an overview of everything in the field of programming. I’m just a novice novice, not yet specialized in a certain language. But my point of view is to know a lot, to know a lot to know how the whole system works, then choose for yourself the language, framework, technology you like best and then invest deeply. In short, know the breadth, then know the depth. I’ve been rambling for a while now, but I mean that I’m currently playing around with many programming languages ​​like C, C++, Python, Ruby… The problem is that when you want to program in a certain language, you have to install the development environment. environment) for each of those languages. As a result, on my compact Mac I have to install a lot of things and then after I lose interest, I sometimes forget to delete, or even if I delete it, it is not clean. And so your computer will have a lot of “junk”. Meanwhile, I am a person who likes neatness, orderliness and cleanliness, so I feel very uncomfortable. At that time, I just found out about Docker through a clip on Youtube, so I also wanted to learn about containers, Docker… While researching, I realized that the image is like that, the container is like that and I came up with the idea that if a container can act as a computer (no GUI), why not use it as a programming environment. So I went to the Docker group on Facebook and asked and Googled with the keyword “development environment docker vscode”, wow, there are results. So I followed the instructions and it worked.

How to organize the workspace (Workspace) I created a folder named Dev, where I store all things related to programming. In the Dev folder create subfolders named programming languages like C, C++, Python, Ruby, TypeScript. It is important that this place, for each directory, I will create a dev container for it. Then in each language folder, I will create project folders. So when I’m in the mood to play with Ruby, I’ll open the Dev/Ruby folder with Visual Studio Code. Then open the folder in the Container (VS Code has this feature). Then you can work with the projects in the container like working on the real machine.

This is my current way of doing it, if you have a better way or have any ideas, please comment.

P/S: How to create a dev environment in a container, please ask Mr.Google.

Share the news now