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.
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
- Sequential I/O throughput
- CPU performance tested using LINPACK
- Virtual Machine (VM):
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 thanapt-get upgrade
. - Always combine
apt-get update
withapt-get install
in the sameRUN
statement. - Prefer
COPY
overADD
, unless you need automatic tarball extraction.