In most areas of computing, the programmer will, at one point, have to test out the code they made. For small, isolated programs that only affect a specific part of a computer or OS, this can be done relatively easily without any fear. However, if a program is very large or important, or if hundreds of programs need to be tested simultaneously, risks to the host OS or machine may arise. The way one circumvents a problem like this is by setting up a new test environment for the program to run in that is isolated from the rest of the software so that no irreversible harm can come to it. There are main options for setting up a test environment.
There are main options for setting up a test environment. The first is by creating a virtual machine. A virtual machine is an isolated environment that is essentially its own operating system. Usually one would use Linux to set one up, and it will run as almost another instance of your computer. Several virtual machines can be set up using organisers, or “hypervisors”, and each instance has its own binary and library files. Only some files are allocated to the process, allowing the process to run independently from the rest of the system.
The problem with virtual machines, however, is that each instance takes up a lot of resources, more than is usually needed for the task. Code tested in one virtual machine may also not always translate perfectly into another OS. That is why the most popular form of isolated environments is called a container. Containers don’t require their own OS, several containers will run on the same engine. This way, they still give all the perks of an isolated environment, without the resource load, making them perfect for running hundreds or thousands of programs simultaneously. The most popular form of containers right now is the Docker engine, which runs on Linux systems. If you ever need to create a space where you need to test a piece of software that may be volatile or you think may contain a virus, it’s always good to set up a docker container so that nothing becomes compromised.