You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/advanced/7_docker/index.mdx
+28-38Lines changed: 28 additions & 38 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,21 +2,36 @@ import DocCard from '@site/src/components/DocCard';
2
2
3
3
# Run Docker containers
4
4
5
-
Windmill supports running any [Docker](https://www.docker.com/) container through its [Bash](../../getting_started/0_scripts_quickstart/4_bash_quickstart/index.mdx) support. As a pre-requisite, the host docker daemon needs to be mounted into the worker container. This is done through a simple volume mount: `/var/run/docker.sock:/var/run/docker.sock`.
5
+
## Using Windmill native docker support (recommended)
6
+
7
+
Windmill has a native docker support if the `# docker` annotation is used in a bash script. It will assume a a docker socket is mounted like in the example above and will take over management of the container as soon as the script ends, assuming that the container was ran with the `$WM_JOB_ID` as name.
8
+
Which is why you should use docker `-d` deamon mode so that the bash script terminates early.
9
+
10
+
It will handle memory tracking, logs streaming and the different exit code of the container properly.
11
+
12
+
The default code is as follows:
13
+
14
+
```
15
+
# docker
16
+
# The annotation "docker" above is important, it tells windmill that after
17
+
# the end of the bash script, it should manage the container at id $WM_JOB_ID:
18
+
# pipe logs, monitor memory usage, kill container if job is cancelled.
19
+
20
+
msg="${1:-world}"
21
+
22
+
IMAGE="alpine:latest"
23
+
COMMAND="/bin/echo Hello $msg"
6
24
7
-
Once Docker is set up, see:
25
+
# ensure that the image is up-to-date
26
+
docker pull $IMAGE
8
27
9
-
<divclassName="grid grid-cols-2 gap-6 mb-4">
10
-
<DocCard
11
-
title="Docker quickstart"
12
-
description="Learn to run a script using from Docker containers."
# if using the 'docker' mode, name it with $WM_JOB_ID for windmill to monitor it
29
+
docker run --name $WM_JOB_ID -it -d $IMAGE $COMMAND
30
+
```
16
31
17
-
## Setup
32
+
###Setup
18
33
19
-
### Docker compose
34
+
####Docker compose
20
35
21
36
On the docker-compose, it is enough to uncomment the volume mount of the Windmill worker
22
37
@@ -25,7 +40,7 @@ On the docker-compose, it is enough to uncomment the volume mount of the Windmil
25
40
# - /var/run/docker.sock:/var/run/docker.sock
26
41
```
27
42
28
-
### Helm charts
43
+
####Helm charts
29
44
30
45
In the charts values of our [helm charts](https://github.com/windmill-labs/windmill-helm-charts), set `windmill.exposeHostDocker` to `true`.
31
46
@@ -77,35 +92,10 @@ Here an example of a a worker group setup with a dind side-container to be adapt
77
92
name: sock-dir
78
93
```
79
94
80
-
## Using Windmill native docker support (recommended)
81
95
82
-
Windmill has a native docker support if the `# docker` annotation is used. It will assume a a docker socket is mounted like in the example above and will take over management of the container as soon as the script ends, assuming that the container was ran with the `$WM_JOB_ID` as name.
83
-
Which is why you should use docker `-d` deamon mode so that the bash script terminates early.
84
-
85
-
It will handle memory tracking, logs streaming and the different exit code of the container properly.
86
-
87
-
The default code is as follows:
88
-
89
-
```
90
-
# docker
91
-
# The annotation "docker" above is important, it tells windmill that after
92
-
# the end of the bash script, it should manage the container at id $WM_JOB_ID:
93
-
# pipe logs, monitor memory usage, kill container if job is cancelled.
94
-
95
-
msg="${1:-world}"
96
-
97
-
IMAGE="alpine:latest"
98
-
COMMAND="/bin/echo Hello $msg"
99
-
100
-
# ensure that the image is up-to-date
101
-
docker pull $IMAGE
102
-
103
-
# if using the 'docker' mode, name it with $WM_JOB_ID for windmill to monitor it
104
-
docker run --name $WM_JOB_ID -it -d $IMAGE $COMMAND
105
-
```
106
96
107
97
108
-
## Using remote container runtimes (not recommended)
0 commit comments