1---
2last_modified_on: "2020-07-13"
3title: Install Vector On Docker
4sidebar_label: Docker
5description: Install Vector on the Docker platform
6source_url: https://github.com/timberio/vector/tree/master/distribution/docker
7---
8
9import CodeExplanation from '@site/src/components/CodeExplanation';
10import ConfigExample from '@site/src/components/ConfigExample';
11import DaemonDiagram from '@site/src/components/DaemonDiagram';
12import ServiceDiagram from '@site/src/components/ServiceDiagram';
13import SidecarDiagram from '@site/src/components/SidecarDiagram';
14import Steps from '@site/src/components/Steps';
15import Tabs from '@theme/Tabs';
16import TabItem from '@theme/TabItem';
17
18Vector maintains the [`timberio/vector` Docker images][urls.docker_hub_vector]
19available on [Docker Hub][urls.docker_hub_vector] which come pre-installed
20with Vector and any recommended system dependencies. These images are available
21for x86_64, ARM64, and ARMv7
22architectures.
23
24<!--
25     THIS FILE IS AUTOGENERATED!
26
27     To make changes please edit the template located at:
28
29     website/docs/setup/installation/platforms/docker.md.erb
30-->
31
32## Install
33
34<Tabs
35  block={true}
36  defaultValue="daemon"
37  values={[{"label":"As a Daemon","value":"daemon"},{"label":"As a Sidecar","value":"sidecar"},{"label":"As a Service","value":"service"}]}>
38<TabItem value="daemon">
39
40The [daemon deployment strategy][docs.strategies#daemon] is designed for data
41collection on a single host. Vector runs in the background, in its own process,
42collecting _all_ data for that host.
43Typically data is collected from a process manager, such as Journald via
44Vector's [`journald` source][docs.sources.journald], but can be collected
45through any of Vector's [sources][docs.sources].
46The following diagram demonstrates how it works.
47
48<DaemonDiagram
49  platformName={"docker"}
50  sourceName={null}
51  sinkName={null} />
52
53---
54
55<Tabs
56  centered={true}
57  className={"rounded"}
58  defaultValue={"docker-cli"}
59  placeholder="Please choose an installation method..."
60  select={false}
61  size={null}
62  values={[{"group":"Platforms","label":"Docker CLI","value":"docker-cli"},{"group":"Platforms","label":"Docker Compose","value":"docker-compose"}]}>
63<TabItem value="docker-cli">
64
65<Steps headingDepth={3}>
66<ol>
67<li>
68
69### Configure Vector
70
71<ConfigExample
72  format="toml"
73  path={"/etc/vector/vector.toml"}
74  sourceName={"docker"}
75  sinkName={null} />
76
77</li>
78<li>
79
80### Start the Vector container
81
82```bash
83docker run \
84  -v $PWD/vector.toml:/etc/vector/vector.toml:ro \
85  -v /var/run/docker.sock:/var/run/docker.sock \
86  timberio/vector:latest-alpine
87```
88
89<CodeExplanation>
90
91* The `-v $PWD/vector.to...` flag passes your custom configuration to Vector.
92* The `-v /var/run/docke...` flag ensures that Vector has access to the Docker API.
93* The `timberio/vector:latest-alpine` is the default image we've chosen, you are welcome to use [other image variants][docs.platforms.docker#variants].
94
95</CodeExplanation>
96
97That's it! Simple and to the point. Hit `ctrl+c` to exit.
98
99</li>
100</ol>
101</Steps>
102
103</TabItem>
104<TabItem value="docker-compose">
105
106compose!
107
108</TabItem>
109</Tabs>
110</TabItem>
111<TabItem value="sidecar">
112
113The [sidecar deployment strategy][docs.strategies#sidecar] is designed to
114collect data from a _single_ service. Vector has a tight 1 to 1 coupling with
115each service. Typically data is collected by tailing local files via Vector's
116[`file` source][docs.sources.file], but can be collected through any of Vector's
117[sources][docs.sources]. The following diagram demonstrates how it works.
118
119<SidecarDiagram
120  platformName={"docker"}
121  sourceName={null}
122  sinkName={null} />
123
124---
125
126<Tabs
127  centered={true}
128  className={"rounded"}
129  defaultValue={"docker-cli"}
130  placeholder="Please choose an installation method..."
131  select={false}
132  size={null}
133  values={[{"group":"Platforms","label":"Docker CLI","value":"docker-cli"},{"group":"Platforms","label":"Docker Compose","value":"docker-compose"}]}>
134<TabItem value="docker-cli">
135
136<Steps headingDepth={3}>
137<ol>
138<li>
139
140### Configure Vector
141
142<ConfigExample
143  format="toml"
144  path={"/etc/vector/vector.toml"}
145  sourceName={"file"}
146  sinkName={null} />
147
148</li>
149<li>
150
151### Start the Vector container
152
153```bash
154docker run \
155  -v $PWD/vector.toml:/etc/vector/vector.toml:ro \
156  -v /var/log \
157  timberio/vector:latest-alpine
158```
159
160<CodeExplanation>
161
162* The `-v $PWD/vector.to...` flag passes your custom configuration to Vector.
163* The `-v /var/log` flag ensures that Vector has access to your app's logging directory, adjust as necessary.
164* The `timberio/vector:latest-alpine` is the default image we've chosen, you are welcome to use [other image variants][docs.platforms.docker#variants].
165
166</CodeExplanation>
167
168That's it! Simple and to the point. Hit `ctrl+c` to exit.
169
170</li>
171</ol>
172</Steps>
173
174</TabItem>
175<TabItem value="docker-compose">
176
177compose!
178
179</TabItem>
180</Tabs>
181</TabItem>
182<TabItem value="service">
183
184The [service deployment strategy][docs.strategies#service] treats Vector like a
185separate service. It is designed to receive data from an upstream source and
186fan-out to one or more destinations.
187Typically, upstream sources are other Vector instances sending data via the
188[`vector` sink][docs.sinks.vector], but can be collected through any of Vector's
189[sources][docs.sources].
190The following diagram demonstrates how it works.
191
192<ServiceDiagram
193  platformName={"docker"}
194  sourceName={null}
195  sinkName={null} />
196
197---
198
199<Tabs
200  centered={true}
201  className={"rounded"}
202  defaultValue={"docker-cli"}
203  placeholder="Please choose an installation method..."
204  select={false}
205  size={null}
206  values={[{"group":"Platforms","label":"Docker CLI","value":"docker-cli"},{"group":"Platforms","label":"Docker Compose","value":"docker-compose"}]}>
207<TabItem value="docker-cli">
208
209<Steps headingDepth={3}>
210<ol>
211<li>
212
213### Configure Vector
214
215<ConfigExample
216  format="toml"
217  path={"/etc/vector/vector.toml"}
218  sourceName={"vector"}
219  sinkName={null} />
220
221</li>
222<li>
223
224### Start the Vector container
225
226```bash
227docker run \
228  -v $PWD/vector.toml:/etc/vector/vector.toml:ro \
229  -p 9000:9000 \
230  timberio/vector:latest-alpine
231```
232
233<CodeExplanation>
234
235* The `-v $PWD/vector.to...` flag passes your custom configuration to Vector.
236* The `-p 9000:9000` flag ensures that port 9000 is exposed for network communication.
237* The `timberio/vector:latest-alpine` is the default image we've chosen, you are welcome to use [other image variants][docs.platforms.docker#variants].
238
239</CodeExplanation>
240
241That's it! Simple and to the point. Hit `ctrl+c` to exit.
242
243</li>
244</ol>
245</Steps>
246
247</TabItem>
248<TabItem value="docker-compose">
249
250compose!
251
252</TabItem>
253</Tabs>
254</TabItem>
255</Tabs>
256
257## Configuring
258
259As shown above, you can pass a custom
260[Vector configuration file][docs.configuration] via the `-v` flag. You'll want
261to do this since the
262[default `/etc/vector/vector.toml` configuration file][urls.default_configuration]
263doesn't do anything.
264
265## Deploying
266
267How you deploy Vector is largely dependent on your use case and environment.
268Please see the [deployment section][docs.deployment] for more info on how to
269deploy Vector.
270
271## Updating
272
273Simply run with newer version in the tag:
274
275```bash
276docker pull timberio/vector:X.X.X-alpine && \
277  docker run timberio/vector:X.X.X-alpine
278```
279
280See the [variants](#variants) and [versions](#versions) sections to choose
281the appropriate image for your use case.
282
283## Images
284
285### Variants
286
287#### alpine
288
289This image is based on the [`alpine` Docker image][urls.docker_alpine], which is
290a Linux distribution built around musl libc and BusyBox. It is considerably
291smaller in size than other Docker images and statically links libraries. This
292is the image we recommend due to it's small size and reliability.
293
294```bash
295docker run timberio/vector:0.10.0-alpine
296```
297
298#### debian
299
300This image is based on the [`debian-slim` image][urls.docker_debian],
301which is a smaller, more compact variant of the [`debian` image][urls.docker_debian].
302
303```bash
304docker run timberio/vector:0.10.0-debian
305```
306
307### Architectures
308
309Vector's images are multi-arch and support the
310x86_64, ARM64, and ARMv7 architectures.
311Docker handles this transparently for you.
312
313### Versions
314
315Vector's Docker images can be downloaded with the following tags. Note that
316Vector maintains special tags that are automatically updated whenever Vector is
317[released][urls.vector_releases]:
318
319| Version          | URL                                                      |
320|:-----------------|:---------------------------------------------------------|
321| Latest major     | `timberio/vector:latest-alpine`               |
322| Latest minor     | `timberio/vector:<MAJOR>.X-alpine`            |
323| Latest patch     | `timberio/vector:<MAJOR.MINOR>.X-alpine`      |
324| Specific version | `timberio/vector:<MAJOR.MINOR.PATCH>-alpine`  |
325| Latest nightly   | `timberio/vector:nightly-alpine`              |
326| Specific nightly | `timberio/vector:nightly-<YYYY-MM-DD>-alpine` |
327
328### Source Files
329
330Vector's Docker source files are located
331[in it's Github repo][urls.vector_docker_source_files].
332
333[docs.configuration]: /docs/setup/configuration/
334[docs.deployment]: /docs/setup/deployment/
335[docs.platforms.docker#variants]: /docs/setup/installation/platforms/docker/#variants
336[docs.sinks.vector]: /docs/reference/sinks/vector/
337[docs.sources.file]: /docs/reference/sources/file/
338[docs.sources.journald]: /docs/reference/sources/journald/
339[docs.sources]: /docs/reference/sources/
340[docs.strategies#daemon]: /docs/setup/deployment/strategies/#daemon
341[docs.strategies#service]: /docs/setup/deployment/strategies/#service
342[docs.strategies#sidecar]: /docs/setup/deployment/strategies/#sidecar
343[urls.default_configuration]: https://github.com/timberio/vector/blob/master/config/vector.toml
344[urls.docker_alpine]: https://hub.docker.com/_/alpine
345[urls.docker_debian]: https://hub.docker.com/_/debian
346[urls.docker_hub_vector]: https://hub.docker.com/r/timberio/vector
347[urls.vector_docker_source_files]: https://github.com/timberio/vector/tree/master/distribution/docker
348[urls.vector_releases]: https://vector.dev/releases/latest/
349