Find out why containers are all the rage at the moment. In this video, explore the basics of Docker.
- [Instructor] So, what is Docker? Apart from having one of the coolest logos out there, you can think of Docker as a platform to develop, deploy and run applications with containers. This means that your application works in exactly the same environment whether that's on your computer or someone else's. This is especially important for machine learning and data science where being able to reproduce your results is incredibly important. You're probably familiar with virtual machines. So, let's use that as our starting point. A virtual machine or VM runs a full-blown guest operating system with virtual access to host resources through a Hypervisor. Now in general VMs provide an environment with more resources than most applications need. So, how are containers different? Well, a container runs natively on Linux and shares the kernel of the host machine with other containers. It runs a discreet process and because it doesn't take any more memory than other executables, it's lightweight. Now one really important thing to consider is if you want to do deep learning and use GPUs, then you're going to need to use the Docker images available from Nvidia and you can get these from their website. So, let's get used to a couple of Docker terminology. An image is an executable package that includes everything needed to run an application, so that's the code, runtime, libraries, environment variables, and the configuration files. And when have a running instance of an image, you've got a container. Now if you were starting off with a machine learning project with a team, you'd probably want to find out what version of Python they're running and then what versions of some of the other packages that they might have. Now you'd probably create a virtual environment and make sure that you have the same version of different packages as everyone else and then you create your code, your machine learning model and then you need to get the same results as in the production environment. Now with Docker, you can just grab a portable Python runtime as an image and there's no installation necessary. Then your build can include the base Python image along with scikit-learn or any other libraries that you require but get this, it also includes your code ensuring that your app, its dependency and the runtime all travel together. So, what we do is define these portable images in something called a Docker file. Now a Docker file is just a couple of lines of text that has instructions that defines what goes on in the environment inside your container, so things like how do you access network resources or what ports do you need to map to reach the outside world? What's nice about this is that once you've created the Docker file, the build of your app defined in this Docker file behaves exactly the same way wherever it runs. Now remember how the whole point of Docker was to keep things portable? So, now that you've built your image from your Docker file, let's go and upload our built image and run it somewhere else. The place we push that to is a Docker registry, so a collection of images is called a repository, a bit like what you have in a GitHub repository and a collection of repositories is a registry. We'll use Docker Hub in this course. There are many public ones to choose from. You can even set up your own private registry. By default, the Docker CLI uses Docker Hub which is Docker's public registry.
- Why Docker is gaining prominence
- Running a container
- Docker under the hood
- Working with Dockerfiles
- Uploading images to Docker Hub
- Common use cases for Docker