Containers package together a installation environment, dependencies, and your code in a portable format that can be moved from computer to computer (for the most part). Instead of installing dependencies directly on your computer (the host machine), dependencies and your code are installed in an image with a base of a particular operating system. This image can be used to run your program on any machine that can run that style of container, regardless of the host operating system version or installed software.
Containers are similar to virtual machines, but they are different classes of virtualization. VMs run an entire guest operating system on the host and virtualize hardware, whereas containers use the host OS's kernel and do not virtualize hardware.