- [Instructor] So we've been using a lot of Docker images without really talking about where they come from. Docker images are retrieved from registries and published through registries. Registries are pieces of software, and there are several options that you can choose if you want to run a registry. They're piece of software that manage and distribute images. You upload images to them, you can download images from them, and they let you search to find the images you want to use. Docker, the company, makes these freely available. You can also run your own as well.
Many companies choose to run their own registry within their own company to ensure that their data stays safe and private. So let's talk about finding images to use. You can search straight from the command line with the Docker search command. Docker search, let's search for Ubuntu. We can see there are a lot of Ubuntu images but one of them is significantly more popular than the others and it's got the official flag which means the Docker organization that runs this repo has verified that it is actually from the Ubuntu organization.
That sounds like a good place to start. Now if you'd like to take a web-based approach to the same thing, you can head on over to hub.docker.com. Give a search for Ubuntu here and see the same information. Or perhaps we want to find a place to run node. Now from the website here, if you click on it, you get a lot more information about how to use this container. They'll list the available tags, information about which one you should use. In general, when choosing an image, it's good to read through the README and figure out how it's intended to be used.
Once you've made an account you can do the rest of the process from the command line. So the command is docker login, just that. It will ask you for your username. I'm thearthur on Docker Hub, and the password, success. I now have an access token on this machine for my account on Docker.io. Now let's push something. I'm just gonna grab a debian image.
Give it a new name, docker tag thearthur. Put your Docker.io login name there, /test-image-42:, and I'll call this version 99.9, okay, docker push thearthur/test-image, okay pushing, pushing, and pushed.
I've now published my Docker image for all the world to use. Couple of bits of advice. One story I heard and fortunately haven't done myself is, don't push images containing your passwords to Docker Hub, even if they're several layers down, just not a good idea. Also, I learned to clean up my images regularly. One day I switched to a different computer and discovered that the container I was using to provide Java hadn't been available in the registry for months.
It was just locally on my computer, and because I hadn't cleared up my local images, I had no idea that I was depending on something that wasn't still available. And there's the matter of trust, this is a general concept. When you're downloading large blobs of things you didn't build yourself, be aware of where you download it from, and who created it, and how much you trust that person. Trust, but you know, occasionally verify.
- Installing Docker on Mac, Windows, and Linux
- Understanding the Docker flow
- Running processes in containers
- Managing, networking, and linking containers
- Working with Docker images, volumes, and registries
- Building Dockerfiles
- Managing networking and namespaces with Docker
- Building entire systems with Docker