[GDD] Docker Registry (Part 1 of 1) 03 December 2018

Let’s jump right in, again. Today’s lesson is short, but important.

 
Last time we created this proxy.yml stack:
 
 
 
 
The last piece missing to running our service is creating the production `stack.yml` file.
 
 
This however, will introduce a new requirement: a Docker registry.
 
This is kinda like the shipyard that houses all of the containers that are packed and ready to ship.
 
 
The Docker registry is a repository for the docker container images you build.
 
 
Fortunately, if you’ve done any development over the past several years you’ve probably used plenty of these. NPM is an example of one. Github another.
 
 
For Docker we'll want to use Docker Hub.
 
 
Earlier in the class we wrote a Dockerfile to create a production build.
 
 
Let’s go through that process one more time to drill it in more, as well as taking it a step further this time by pushing it to a repository as well.
 
 
First, head on over to https://hub.docker.com/ and create an account if you don’t already have one.
 
 
Next, in your terminal, login:
 
docker login
 
Now, back in our `split-test-tutorial` directory we’ve been working in, lets build, tag, and push our image.
 
docker build -t split-test .
docker tag split-test patrickleet/split-test
docker push patrickleet/split-test
 
Build. Tag. Push. You're going to want to replace my username "patrickleet", with your username on Docker Hub though!
 
And here mine is: https://hub.docker.com/r/patrickleet/split-test/

 
Easy peasy!
 
 
Now we have everything we need to build the production stack.yml file.
 
 
We shouldn’t run this process manually every time though.
 
 
Tomorrow we’ll explore ways in which we can automate it.
 
 
First though, I want to mention that docker hub is not the only registry you can use. There are plenty of options ranging from free to enterprise. I personally think Docker Hub is the simplest to get started with, but feel free to explore other options.
 
 
Docker even provides an image for it's registry if you'd like to host your own by running a container in your cluster:
 
Patrick “Registry Pusher” Scott