I’m slowly incrementing the number of projects I host in my personal servers and as the number increases I find the need to standardize the way I deploy each service. Currently each service has a different way of running and I have to try to remember how to do it each time I have an update. As one of the steps to a more streamlined deploy process I decided for each service to have a production ready image hosted in a Docker registry. The deploy will then just be a matter of downloading and running the image in the production machine (not perfect, but a step forward).

My first idea was to host a Docker registry myself, but luckily I found a service that offers 20 private repositories for free. To start using canister.io, you just need to register for the basic plan and create a new repo.

To push images you can use the command line. Start by logging in:

1
docker login --username=username cloud.canister.io:5000

The next step is to tag an image that you want to publish:

1
docker tag ae5da82730b1 cloud.canister.io:5000/username/my-repo:latest

Notice the format of the tag: //:. I used latest as my tag name but you can use any tag name you want.

Finally we just need to push the tag:

1
docker push cloud.canister.io:5000/username/my-repo

Note that this command doesn’t include the tag being pushed. It will push all tags in the given repo.

For the deploy I had to do something similar. First, log in to canister.io in the production server:

1
docker login --username=username cloud.canister.io:5000

Pull the image:

1
docker pull cloud.canister.io:5000/username/my-repo:latest

And finally start it:

1
docker run -d --restart=on-failure --name my-service-container cloud.canister.io:5000/username/my-repo:latest
[ linux  automation  docker  productivity  ]
Instrumenting an Istio Cluster With Jaeger Tracing
Monitoring Kubernetes Resources with Fabric8 Informers
Resource Management in Kubernetes - Requests and Limits
Kubernetes ConfigMaps
Command Line Efficiency With Tmux