yunpengn / TryDocker

My first attempt with Docker

Home Page:https://yunpengn.github.io/TryDocker/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

TryDocker

This repository helps me to learn Docker. It contains some explanations, which could be useful to beginners. It also contains an example on how to setup a simple Rails web application with PostgreSQL using Docker.

Why Docker?

There are a few technologies and/or softwares to be compared as follows:

  • Docker: a container-based virtualization solution that helps to develop, deploy and run application seamlessly. A container provides an independent environment to run an application, but under the same operating system. It takes almost no more resource than running the application natively. The diagrams below are taken from a research paper from IBM.
    • CPU performance tested using LINPACK
      Linpack performance
    • Sequential I/O throughput
      Sequential IO
  • Virtual Machine (VM):

Writing Dockerfile

Below are some tips for writing a Dockerfile with best practices:

  • Do not include irrelevant files (or libraries, tools) inside the build context (the working directory when running the docker build command). This will result in a larger image size.
  • Use a .dockerignore file to exclude those irrelevant files.
  • Make sure the generated container is self-contained. People should be able to use it with minimum setup.
  • Create the right number of layers rather than minimize the number of layers (due to multi-stage builds).
  • Use apt-get install -y rather than apt-get upgrade.
  • Always combine apt-get update with apt-get install in the same RUN statement.
  • Prefer COPY over ADD, unless you need automatic tarball extraction.

Acknowledgements

Licence

GNU General Public Licence 3.0

About

My first attempt with Docker

https://yunpengn.github.io/TryDocker/

License:GNU General Public License v3.0


Languages

Language:Ruby 77.8%Language:HTML 16.2%Language:JavaScript 3.4%Language:CSS 2.0%Language:Dockerfile 0.6%