-
Notifications
You must be signed in to change notification settings - Fork 1
/
yml.html
190 lines (160 loc) · 8.17 KB
/
yml.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
<!DOCTYPE html>
<html lang="en-gb">
<head>
<meta charset="utf-8">
<title>fig.yml reference</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link href='https://fonts.googleapis.com/css?family=Lilita+One|Lato:300,400,700' rel='stylesheet' type='text/css'>
<link rel="stylesheet" type="text/css" href="css/bootstrap.min.css">
<link rel="stylesheet" type="text/css" href="css/fig.css?20150226081472935746419">
<link rel="canonical" href="http://www.fig.sh/yml.html">
</head>
<body>
<div class="container">
<nav class="deprecation">
<p>Fig has been replaced by Docker Compose, and is now deprecated. The new documentation is on the <a href="http://docs.docker.com/compose/yml">Docker website</a>.</p>
</nav>
<div class="logo mobile-logo">
<a href="index.html">
<img src="img/logo.png">
Fig
</a>
</div>
<div class="content"><h1>fig.yml reference</h1>
<p>Each service defined in <code>fig.yml</code> must specify exactly one of <code>image</code> or <code>build</code>. Other keys are optional, and are analogous to their <code>docker run</code> command-line counterparts.</p>
<p>As with <code>docker run</code>, options specified in the Dockerfile (e.g. <code>CMD</code>, <code>EXPOSE</code>, <code>VOLUME</code>, <code>ENV</code>) are respected by default - you don't need to specify them again in <code>fig.yml</code>.</p>
<h3>image</h3>
<p>Tag or partial image ID. Can be local or remote - Fig will attempt to pull if it doesn't exist locally.</p>
<div class="highlight"><pre><code class="text language-text" data-lang="text">image: ubuntu
image: orchardup/postgresql
image: a4bc65fd
</code></pre></div>
<h3>build</h3>
<p>Path to a directory containing a Dockerfile. Fig will build and tag it with a generated name, and use that image thereafter.</p>
<div class="highlight"><pre><code class="text language-text" data-lang="text">build: /path/to/build/dir
</code></pre></div>
<h3>command</h3>
<p>Override the default command.</p>
<div class="highlight"><pre><code class="text language-text" data-lang="text">command: bundle exec thin -p 3000
</code></pre></div>
<p><a name="links"></a></p>
<h3>links</h3>
<p>Link to containers in another service. Either specify both the service name and the link alias (<code>SERVICE:ALIAS</code>), or just the service name (which will also be used for the alias).</p>
<div class="highlight"><pre><code class="text language-text" data-lang="text">links:
- db
- db:database
- redis
</code></pre></div>
<p>An entry with the alias' name will be created in <code>/etc/hosts</code> inside containers for this service, e.g:</p>
<div class="highlight"><pre><code class="text language-text" data-lang="text">172.17.2.186 db
172.17.2.186 database
172.17.2.187 redis
</code></pre></div>
<p>Environment variables will also be created - see the <a href="env.html">environment variable reference</a> for details.</p>
<h3>ports</h3>
<p>Expose ports. Either specify both ports (<code>HOST:CONTAINER</code>), or just the container port (a random host port will be chosen).</p>
<p><strong>Note:</strong> When mapping ports in the <code>HOST:CONTAINER</code> format, you may experience erroneous results when using a container port lower than 60, because YAML will parse numbers in the format <code>xx:yy</code> as sexagesimal (base 60). For this reason, we recommend always explicitly specifying your port mappings as strings.</p>
<div class="highlight"><pre><code class="text language-text" data-lang="text">ports:
- "3000"
- "8000:8000"
- "49100:22"
- "127.0.0.1:8001:8001"
</code></pre></div>
<h3>expose</h3>
<p>Expose ports without publishing them to the host machine - they'll only be accessible to linked services. Only the internal port can be specified.</p>
<div class="highlight"><pre><code class="text language-text" data-lang="text">expose:
- "3000"
- "8000"
</code></pre></div>
<h3>volumes</h3>
<p>Mount paths as volumes, optionally specifying a path on the host machine
(<code>HOST:CONTAINER</code>), or an access mode (<code>HOST:CONTAINER:ro</code>).</p>
<div class="highlight"><pre><code class="text language-text" data-lang="text">volumes:
- /var/lib/mysql
- cache/:/tmp/cache
- ~/configs:/etc/configs/:ro
</code></pre></div>
<h3>volumes_from</h3>
<p>Mount all of the volumes from another service or container.</p>
<div class="highlight"><pre><code class="text language-text" data-lang="text">volumes_from:
- service_name
- container_name
</code></pre></div>
<h3>environment</h3>
<p>Add environment variables. You can use either an array or a dictionary.</p>
<p>Environment variables with only a key are resolved to their values on the machine Fig is running on, which can be helpful for secret or host-specific values.</p>
<div class="highlight"><pre><code class="text language-text" data-lang="text">environment:
RACK_ENV: development
SESSION_SECRET:
environment:
- RACK_ENV=development
- SESSION_SECRET
</code></pre></div>
<h3>net</h3>
<p>Networking mode. Use the same values as the docker client <code>--net</code> parameter.</p>
<div class="highlight"><pre><code class="text language-text" data-lang="text">net: "bridge"
net: "none"
net: "container:[name or id]"
net: "host"
</code></pre></div>
<h3>dns</h3>
<p>Custom DNS servers. Can be a single value or a list.</p>
<div class="highlight"><pre><code class="text language-text" data-lang="text">dns: 8.8.8.8
dns:
- 8.8.8.8
- 9.9.9.9
</code></pre></div>
<h3>working_dir, entrypoint, user, hostname, domainname, mem_limit, privileged</h3>
<p>Each of these is a single value, analogous to its <a href="https://docs.docker.com/reference/run/">docker run</a> counterpart.</p>
<div class="highlight"><pre><code class="text language-text" data-lang="text">working_dir: /code
entrypoint: /code/entrypoint.sh
user: postgresql
hostname: foo
domainname: foo.com
mem_limit: 1000000000
privileged: true
</code></pre></div></div>
<div class="sidebar">
<h1 class="logo">
<a href="index.html">
<img src="img/logo.png">
Fig
</a>
</h1>
<ul class="nav">
<li><a href="index.html">Home</a></li>
<li><a href="install.html">Install</a></li>
<li><a href="rails.html">Get started with Rails</a></li>
<li><a href="django.html">Get started with Django</a></li>
<li><a href="wordpress.html">Get started with Wordpress</a></li>
</ul>
<ul class="nav">
<li>Reference:</li>
<ul>
<li><a href="yml.html">fig.yml</a></li>
<li><a href="cli.html">Commands</a></li>
<li><a href="env.html">Environment variables</a></li>
</ul>
</ul>
<ul class="nav">
<li><a href="https://github.com/docker/fig">Fig on GitHub</a></li>
<li><a href="http://webchat.freenode.net/?channels=%23docker-fig&uio=d4">#docker-fig on Freenode</a></li>
</ul>
<p>Fig is a project from <a href="https://www.docker.com">Docker</a>.</p>
<div class="badges">
<iframe src="https://ghbtns.com/github-btn.html?user=docker&repo=fig&type=watch&count=true" allowtransparency="true" frameborder="0" scrolling="0" width="100" height="20"></iframe>
<a href="https://twitter.com/share" class="twitter-share-button" data-url="http://www.fig.sh/">Tweet</a>
</div>
</div>
</div>
<script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?'http':'https';if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=p+'://platform.twitter.com/widgets.js';fjs.parentNode.insertBefore(js,fjs);}}(document, 'script', 'twitter-wjs');</script>
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-43996733-3', 'auto');
ga('send', 'pageview');
</script>
</body>
</html>