Easily resizable with cgroups
Static number of CPUs, RAM
| Unit | Native | Docker | KVM Untuned | KVM Tuned |
|---|---|---|---|---|
| MB/s | 0% | -4% | -22% | -18% |
| Unit | Native | Docker | KVM Untuned | KVM Tuned |
|---|---|---|---|---|
| GFLOPS | 0% | -0% | -17% | -2% |
| Unit | Native | Docker | KVM Untuned | KVM Tuned |
|---|---|---|---|---|
| GB/s | 0% | -0% | -(1-3)% | -- |
| Unit | Native | Docker | KVM Untuned | KVM Tuned |
|---|---|---|---|---|
| GB/s | 0% | -2% | -1% | -- |
# Dockerfile
FROM ubuntu:16.04
RUN apt-get update
RUN apt-get install gcc make
COPY ./src ./
RUN make configure
RUN make install
CMD ./my_app
$ tree .
.
├── src
│ ├── Makefile
│ ├── my_app.cpp
└── Dockerfile
## Pull
$ docker pull my_repo/my_app
> ...
## Run
$ docker run my_repo/my_app
> Hello, Docker!
# my_app.cpp
#include <stdio>
int main(int argc, char *argv[]) {
std::cout << "Hello, Docker!" << std::endl;
return 0;
}
## Build
$ docker build -t my_repo/my_app .
> ...
## Push
$ docker push my_repo/my_app
> ...
version: '2'
services:
postgres:
image: postgres:9.5.6
expose:
- "5432"
volumes:
- ./data/postgres:/var/lib/postgresql/data
redis:
image: redis
expose:
- "6379"
volumes:
- ./data/redis/:/var/lib/redis/data/
nginx:
build: ./nginx
image: nginx:1.11.9
ports:
- "80:80"
- "443:443"
links:
- web
volumes:
- .:/usr/src/app/ web:
build: .
environment:
- RAILS_ENV=${RAILS_ENV}
- SECRET_KEY_BASE=${SECRET_KEY_BASE}
- SECRET_TOKEN=${SECRET_TOKEN}
- WEB_CONCURRENCY=${WEB_CONCURRENCY}
- MAX_THREADS=${MAX_THREADS}
volumes:
- .:/usr/src/app/
depends_on:
- postgres
- redis
command: bundle exec puma -C config/puma.rb
expose:
- "3000"
worker:
build: .
environment:
- RAILS_ENV=${RAILS_ENV}
volumes:
- .:/usr/src/app/
depends_on:
- postgres
- redis
command: bundle exec crono