Tips for writing Dockerfile

Started using Docker yet? Here are some tips on writing dockerfile for your application.
While may be obvious to docker experts, these tips might help you avoid common issues.

1. Minimize the number of layers.

FROM ubuntu:16.04
RUN apt-get update
RUN apt-get install node
RUN apt-get install npm
RUN apt-get install curl

Apt-get would be the most used command in all docker files command. While the above dockerfile looks fine, it has a couple of issues.

  1. apt-get update and apt-get install’s are on different lines, which would lead to caching of apt-get update command. Read more on docker build cache.
  2. Each of the RUN statements creates a layer in docker image, this leads to a bulkier image, try clubbing RUN commands logically.

A Better build would start like –

FROM ubuntu:16.04
RUN apt-get update && apt-get install -y curl \

2. Use .dockerignore

Continue reading

Blue Ocean – Create Pipelines easily

BlueOcean is a plugin on top of Jenkins which makes creating and maintaining piplines fun.

Getting Started


If you want to start playing with it the easiest way to get started is through docker.
docker run -p 8080:8080 jenkinsci/blueocean
This will pull the image from docker-registry and run Blueocean with Jenkins locally.

Manual Installation

If you directly want to set it up on a VM or locally, jenkins doc should be a good starting point.

Defining a pipeline

Blueocean’s preferred source of pipeline configuration is Jenkinsfile. Jenkinsfile is built on the motivation of pipeline as code. Jenkinsfile describes the steps and execution details of tasks in the pipeline.

Creating a pipeline involves selecting the repository, blueocean out of the box supports git.

Task definition can be either created by the visual editor Or created manually. For a sample Jenkins file i will use the configuration below.

Or created manually. For a sample Jenkins file i will use the configuration below.

Build your project

Builds can be triggered manually or through webhooks integration.

I hope this post gives you the basic idea about what blueocean is and if it might be worth trying.