Giter VIP home page Giter VIP logo

dockerfile-best-practices's Introduction

Best Practices writing a Dockerfile

This repository is a guide with a set of good practices when writting Dockerfiles.

Using a Node.js application as example, this guide will be a journey from a very basic Dockerfile to make it production ready, describing some of the best practices and common pitfalls that you are likely to encounter when developing Dockerfiles.

Before we start

On this blog post you'll find detailed information about each of the steps we'll do to improve the Dockerfile. Please use it to follow this tutorial.

Note: the blog post was published on February 2019. There are corrections and updates only available on this GitHub repository.

Enable BuilKit

Use BuildKit to build your Docker images. It can improve the performance when building Docker images.

It can be enabled on two different ways:

  • Exporting the DOCKER_BUILDKIT environment variable:
export DOCKER_BUILDKIT=1

TIP: add it to your ~/.bashrc file

{
  "features": {
    "buildkit": true
  }
}

Install a Linter for Dockerfiles on your IDE

A Linter helps you to detect syntax errors on your Dockerfiles and provides you suggestions based on common practices.

There are plugins that provide these functionalities for almost every IDE. Here you have some suggestions:

How to use this tutorial

Starting from the 'master' branch, you'll find a branch with the files to use on each step of the tutorial.

It's only necessary to switch (checkout) to the proper branch. The available branches are:

dockerfile-best-practices's People

Contributors

juan131 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.