Docker Container Tutorial – How to build a Docker Container & Image
This tutorial covers how to build a docker container. It covers everything you need to know from setting up boot2docker on your machine to building and deploying your first Docker webapp.
Code is in this repo:
Get Boot2docker here:
Running a Docker Container:
What is Nginx:
Our goal for this video is to convert a static html site into a docker image that we, as a web developer, can run on any linux server with zero configuration – cause if there’s one thing a web developer despises, it’s configuration.
High-Availability Docker #1:
– Cluster computing – CoreOS is our solution here. CoreOS allows us to make an expandable cluster of computers so we can add more computers should our application need more power to scale. CoreOS also allows us to run services on any machine in the cluster and they can all communicate with each other.
High-Availability Docker #2:
– Scheduling: we shouldn’t manually choose which app runs on which machine – this thought doesn’t work at scale. Fleet will be our scheduler that decides where our apps/services run. If a CoreOS machine goes down, fleet will reschedule any services that it was running onto a new machine.
High-Availability Docker #3:
– Service Registration
Since we never know what ip address or port a service will be running on, we need to register that service so other services can find it and communicate with it. We’ll use Etcd and Flannel for this
High-Availability Docker #4:
– Service Discovery:
Now that services have registered, we can learn them and load balance between them with a generic docker nginx container
High-Availability Docker #5:
– Public DNS: Once the app is working, we need a fixed way for the outside world to access it. We’ll use Nginx and Confd for this. Confd will watch Etcd for service registration and when services come/go, it will build a new configuration file for Nginx and reload Nginx.
Also watch: “Responsive Design Tutorial – Tips for making web sites look fantastic on any device”