UNPKG

3.04 kBMarkdownView Raw
1# Common Container Configuration Format
2
3The Common Container Configuration Format (cccf) is an attempt at creating a standard container configuration format, in JSON.
4
5It describes containers, their properties and the relationship between them. This repository will include a JSON schema validator for the cccf.
6
7The format is extensible so other modules can expand it's capabilities and semantics.
8
9**DISCLAIMER** WORK IN PROGRESS
10
11## Example
12
13 {
14 "id" : "app", // Container Id
15 "image" : "megacorp/webapp", // Image path
16 "cmd" : "python server.py", // Command to run (optional)
17 "ports" : ["80:80"], // List of port mappings (optional)
18 "env" : ["FOO=BAR"], // Environment variables (optional)
19 "volumes" : ["/tmp:/tmp"], // Container volumes (optional)
20 "expose" : ["8000","3000"] // Exposed ports (optional)
21 }
22
23### Id
24
25The id, **app** in the example, is the container identifier. It can be any arbitrary string. No spaces.
26
27### Image
28
29The image, **megacorp/webapp** in the example, is URI to the container image. It can be any valid URI, relative or full.
30
31### Cmd
32
33The cmd, **python server.py** in the example, is the command to execute when running the container. It can be an arbitrary string.
34
35### Ports
36
37The ports, **["80:80"]** in the example, is a list of port mappings. A port mapping is defined using a string with two ports separated by a colon: **"host-port:container-port"** where ***host-port*** references a port on the host running the container, and the ***container-port*** references a port inside the running container.
38
39### Env
40
41The env, **["FOO=BAR"]** in the example, is a list of environment variables. An evironment variable is defined using a string with a key and a value separated by a equals sign: **"key=value"**.
42
43### Volumes
44
45The volumes, **["/tmp:/tmp"]** in the example, is a list of volumes to mount inside the container. There are two different ways to specify a volume:
46
47 "/host/path:/container/path" // Mounts a specified path on the host to the specified path in the container
48 "/host/path" // Mounts a specified path on the host to the same path in the container
49
50### Expose
51
52Expose, **["8000","3000"]** in the example, is a list of ports the container exposes.
53
54## Install the module
55
56 npm install cccf
57
58## Use the module
59
60 var cccf = require('cccf')
61 var container = require('./container.json')
62 var containers = require('./containers.json')
63
64 var errors1 = cccf.validate(container)
65 var errorsX = cccf.validateMultiple(containers)
66
67## HALP
68
69Is this a good idea at all? What is missing? Typos? Messed up semantics? Please file issues!
70
71Stuff I would like to see:
72
73* Docker cccf extension (adding links, volumes_from, etc.)
74* A cluster module that adds grouping and scale
75* A resource module that adds required resources (CPU, MEM, DISK, etc.)
76* A [fig](http://www.fig.sh/yml.html) (yml) parser module.