Docker Series

This will be a small introduction series to the world of Docker.
I’ll be going over the following topics:

  • Simpler usage of docker containers.
  • Data Volumes and mounting host directory in a container.
  • Building your own docker image.
  • Running multiple containers simultaneously(Docker Compose).
  • Docker cluster management and orchestration features(Docker Swarm).

    Disclaimer: Most of the things that I will be going through will be for beginners and will contain stuff from the official documentation of Docker.

My adventures with AWS

I had applied for the GitHub Student Developer Pack. I had $150 in credits for AWS. 😎

I decided to put this to good use. I have started exploring Amazon EC2, Amazon Elastic BeanstalkAmazon EC2 Container Service. The aws-cli is really pretty awesome with the little use that I have done so far. As I go, I will keep updating this repo aws-scripts with the scripts I prepare. As this is just my testing with aws-cli scripts, these scripts will be hard coded and in general may not be usable anywhere else without a little tweaking.

I will keep blogging about my adventure, all my successes and failures as well.

Docker Registry on local network.

So, we all have used Docker Hub and it’s private repositories, but sometimes, if we want to do some testing on the local network and want to save some bandwidth, we could set up our own Docker Registry. If you want to read that documentation that’s fine. But this is to just get you running.

The machine on which you want to configure the registry(Let’s call it the server) must have a static IP. Add an entry to your /etc/hosts file (Linux or MAC). Then follow these steps (Run these on the server only.)

mkdir -p certs && openssl req \ -newkey rsa:4096 -nodes -sha256 -keyout certs/docker.key \ -x509 -days 365 -out certs/docker.crt

Then, run this command. (Obviously you have docker installed and configured for your user! You’re not that dumb. 😉 )

docker run -d -p 5000:5000 --restart=always --name registry \
-v `pwd`/data:/var/lib/registry \
-v `pwd`/certs:/certs \
-e REGISTRY_HTTP_TLS_CERTIFICATE=/certs/docker.crt \
-e REGISTRY_HTTP_TLS_KEY=/certs/docker.key \
registry:2

You are almost done! Just two more steps left to configure your docker engine to talk to this registry. (These must be done on your local machines)

  1. Copy the docker.crt file to /etc/docker/certs.d/docker.local:5000/ca.crt
  2. Restart Docker Engine. (systemctl restart docker)

Sources

  • https://docs.docker.com/registry/insecure/#/using-self-signed-certificates
  • https://docs.docker.com/registry/deploying/#get-a-certificate
  • https://docs.docker.com/registry/deploying/#storage