-
Notifications
You must be signed in to change notification settings - Fork 1
/
cli.html
203 lines (138 loc) · 7.87 KB
/
cli.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
191
192
193
194
195
196
197
198
199
200
201
202
203
<!DOCTYPE html>
<html lang="en-gb">
<head>
<meta charset="utf-8">
<title>Fig CLI 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/cli.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/cli">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>CLI reference</h1>
<p>Most commands are run against one or more services. If the service is omitted, it will apply to all services.</p>
<p>Run <code>fig [COMMAND] --help</code> for full usage.</p>
<h2>Options</h2>
<h3>--verbose</h3>
<p>Show more output</p>
<h3>--version</h3>
<p>Print version and exit</p>
<h3>-f, --file FILE</h3>
<p>Specify an alternate fig file (default: fig.yml)</p>
<h3>-p, --project-name NAME</h3>
<p>Specify an alternate project name (default: directory name)</p>
<h2>Commands</h2>
<h3>build</h3>
<p>Build or rebuild services.</p>
<p>Services are built once and then tagged as <code>project_service</code>, e.g. <code>figtest_db</code>. If you change a service's <code>Dockerfile</code> or the contents of its build directory, you can run <code>fig build</code> to rebuild it.</p>
<h3>help</h3>
<p>Get help on a command.</p>
<h3>kill</h3>
<p>Force stop service containers.</p>
<h3>logs</h3>
<p>View output from services.</p>
<h3>port</h3>
<p>Print the public port for a port binding</p>
<h3>ps</h3>
<p>List containers.</p>
<h3>pull</h3>
<p>Pulls service images.</p>
<h3>rm</h3>
<p>Remove stopped service containers.</p>
<h3>run</h3>
<p>Run a one-off command on a service.</p>
<p>For example:</p>
<div class="highlight"><pre><code class="text language-text" data-lang="text">$ fig run web python manage.py shell
</code></pre></div>
<p>By default, linked services will be started, unless they are already running.</p>
<p>One-off commands are started in new containers with the same config as a normal container for that service, so volumes, links, etc will all be created as expected. The only thing different to a normal container is the command will be overridden with the one specified and no ports will be created in case they collide.</p>
<p>Links are also created between one-off commands and the other containers for that service so you can do stuff like this:</p>
<div class="highlight"><pre><code class="text language-text" data-lang="text">$ fig run db psql -h db -U docker
</code></pre></div>
<p>If you do not want linked containers to be started when running the one-off command, specify the <code>--no-deps</code> flag:</p>
<div class="highlight"><pre><code class="text language-text" data-lang="text">$ fig run --no-deps web python manage.py shell
</code></pre></div>
<h3>scale</h3>
<p>Set number of containers to run for a service.</p>
<p>Numbers are specified in the form <code>service=num</code> as arguments.
For example:</p>
<div class="highlight"><pre><code class="text language-text" data-lang="text">$ fig scale web=2 worker=3
</code></pre></div>
<h3>start</h3>
<p>Start existing containers for a service.</p>
<h3>stop</h3>
<p>Stop running containers without removing them. They can be started again with <code>fig start</code>.</p>
<h3>up</h3>
<p>Build, (re)create, start and attach to containers for a service.</p>
<p>Linked services will be started, unless they are already running.</p>
<p>By default, <code>fig up</code> will aggregate the output of each container, and when it exits, all containers will be stopped. If you run <code>fig up -d</code>, it'll start the containers in the background and leave them running.</p>
<p>By default if there are existing containers for a service, <code>fig up</code> will stop and recreate them (preserving mounted volumes with <a href="http://docs.docker.io/en/latest/use/working_with_volumes/">volumes-from</a>), so that changes in <code>fig.yml</code> are picked up. If you do no want containers to be stopped and recreated, use <code>fig up --no-recreate</code>. This will still start any stopped containers, if needed.</p>
<h2>Environment Variables</h2>
<p>Several environment variables can be used to configure Fig's behaviour.</p>
<p>Variables starting with <code>DOCKER_</code> are the same as those used to configure the Docker command-line client. If you're using boot2docker, <code>$(boot2docker shellinit)</code> will set them to their correct values.</p>
<h3>FIG_PROJECT_NAME</h3>
<p>Set the project name, which is prepended to the name of every container started by Fig. Defaults to the <code>basename</code> of the current working directory.</p>
<h3>FIG_FILE</h3>
<p>Set the path to the <code>fig.yml</code> to use. Defaults to <code>fig.yml</code> in the current working directory.</p>
<h3>DOCKER_HOST</h3>
<p>Set the URL to the docker daemon. Defaults to <code>unix:///var/run/docker.sock</code>, as with the docker client.</p>
<h3>DOCKER_TLS_VERIFY</h3>
<p>When set to anything other than an empty string, enables TLS communication with the daemon.</p>
<h3>DOCKER_CERT_PATH</h3>
<p>Configure the path to the <code>ca.pem</code>, <code>cert.pem</code> and <code>key.pem</code> files used for TLS verification. Defaults to <code>~/.docker</code>.</p>
</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>