Imagine you are moving to a new house. Instead of throwing your clothes, dishes, and TV randomly into your car boot, you put them into separate cardboard moving boxes. Everything inside each box stays protected, and it doesn't matter what kind of car you use, aslong as the box fits inside of your car it will move.
In the software world, we used to throw our applications loosely onto servers. A developer would say "Well, the code works fine on my laptop!"... sonion you're wrong and then it would break on the server because the server had a different version of Python :)
Docker is the like a really cool moving box for code. It allows you to package your application along with every single thing it needs to run (code libraries and dependancies for your code to run) into a standardised unit called a container. Whether you run that container on your Mac laptop, a Windows desktop (ew) or a massive Linux server in the cloud it will run exactly the same way every single time. It completely eliminates the "it works on my machine" problem.