(Offtopic?) Why do we need containers and VMs when developing softwares and web apps?

Ok, I know this might be a little bit off topic, but I keep hearing people talking about containers like docker, and developing on VMs or something like that. I don’t understand the whole process or why when developing softwares, we need those things. Could someone explain to me what do they really do and the whole process of developing a software/webapp?

In my knowledge, the whole developing process goes something like this:

1 . We wrote code on our end (our laptops/desktops)
2 . We push the code to the server.
3 . User download those code from the server and use the webapp/software.

So why do we need container/vm then?

2 Likes

2 important aspects:

Our laptop doesn’t have the same configuration as the server where the code will ultimately run. Code that works fine on your dev box may crash in production. In order to mimic the same environment you can use a vm/container with the same configuration as the server (you usually have something like chef or puppet for the config scripts), or you can even deploy the container straight to the production servers and run it there.

The second aspect is resource management. If you have a physical box with 4 CPUs, 16GB RAM, but your app only needs 2 CPUs and 8GB you can use a vm/container with the right settings and leave a significant amount of resources for someone else to use.

2 Likes

I’m on a Mac OSX. It’s my preferred environment. But all my corporate clients are Microsoft shops. So that means, I need to develop/test websites that run on Microsoft IIS servers (running ASP, or ASP.NET C#) and using Microsoft SQL Database Servers.

Back then, I used to have (2) Windows servers on my server rack. Big honking machines, 4u rack tall. Noisy as hell. It’s my development server running IIS Web Server and SQL Server. I’ve setup my servers to mimic my client’s production server as close as possible, in terms of installed software. It’s also my file server, where I keep all my files on a RAID drive setup. Got a big 3u rack UPS also on the same rack, and a 12-port 100MB-Fast Ethernet switch.

So you get the picture? I have my workstation, and I also have a separate Windows server machine. All plugged in, running 24/7.

Fast forward today… I retired my hardware servers, and now instead run my Windows IIS Server and SQL Database Server as VMs inside my Mac OSX. I run the web browser on the Mac side, to access the virtual host running in Windows/IIS server on the Windows/VM machine. In addition, I can also develop using Visual Studio on the Windows side, without the need for a separate Windows laptop/PC. It’s all living inside my Mac machine.

My office is now quieter, much cooler… without the constant hum of my server fans. In addition, I can run different versions of Windows (anywhere from 2000, XP, 7, 8 to 10) on the same Mac machine. If I need to test how a website will work on a very old IE version or whatever, I can do so easily.

Oh, and it’s not just limited to Windows VM. You can also run other kinds of OS, like Linux. The nice thing about a VM is you dont have to triple boot, you can run all OS/VM at the same time.

OSX running an Ubuntu VM and a Windows 10 VM (showing Visual Studio 2017). On the Windows machine, you can see various versions of Visual Studio, and different versions of SQL Server (2012, 2014), + the IIS Web server.

3 Likes

Thank you for your information and contribution.

Hmmmm cool. May I ask what is the specs of your mac??

Also if let’s say that in the future I am building a website for my client, I have to test my website on chrome/IE/firefox/safari on both windows and macOS? So I just fire up the VMs and test them one by one?

So what you are saying is that you can make containers working like a clone of the actual server. So you can “test some water 1st”, before you actually deploy all your code to the actual server. Is that it?

In addition to what was said above, I use VMs as a safety net. This doesn’t really come up in JavaScript, but there are some things that you can do in other languages to really hose up your computer. Also, sometimes I want to test out doing something funky to my environment with an easy way to undo it. I :heart: snapshots.

2 Likes

Okay, this might seems unprofessional, but what kind of vmware are you using??

Vagrant? virtual box? parallel? or??

I’ve mostly used VMWare, but I’ve also used Vagrant and VirtualBox a couple times.

1 Like

Love, love, love, Snapshots!

No stress/no worries when updating the OS or a piece of software.

It’s like a big UNDO when you royally screw up.

1 Like