Chapter 3. Using Docker as a lightweight virtual machine
This chapter covers
- Converting a virtual machine to a Docker image
- Managing the startup of your container’s services
- Saving your work as you go
- Managing Docker images on your machine
- Sharing images on the Docker Hub
- Playing—and winning—at 2048 with Docker
Virtual machines (VMs) have become ubiquitous in software development and deployment since the turn of the century. The abstraction of machines to software has made the movement and control of software and services in the internet age easier and cheaper.
Virtual machines
A virtual machine is an application that emulates a computer, usually to run an operating system and applications. It can be placed on any (compatible) physical resources that are available. The end user experiences the software as though it were on a physical machine, but those managing the hardware can focus on larger-scale resource allocation.
Docker isn’t a VM technology. It doesn’t simulate a machine’s hardware and it doesn’t include an operating system. A Docker container is not by default constrained to specific hardware limits. If Docker virtualizes anything, it virtualizes the environment in which services run, not the machine. Moreover, Docker can’t easily run Windows software (or even that written for other UNIX-derived operating systems).