Skip to content

Commit fa7c293

Browse files
Merge pull request #35 from Roblox/example
Add hello world example job.
2 parents cbcc1b3 + 96943f5 commit fa7c293

File tree

2 files changed

+40
-0
lines changed

2 files changed

+40
-0
lines changed

example/README.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,25 @@ Copy the allocation ID from the output of `nomad job status` command.
1919
$ nomad alloc exec -i -t <allocation_id> /bin/sh
2020
```
2121

22+
## Hello World
23+
24+
```
25+
$ nomad job run hello.nomad
26+
```
27+
will start a container using `nomad-driver-containerd` which runs an infinite loop printing
28+
`hello world` and sleeps for `3 seconds` between each iteration. This is a basic `hello world`
29+
program which can be used to test launching containers using `nomad-driver-containerd`.
30+
31+
**Check allocation logs**
32+
33+
```
34+
$ nomad alloc logs -f -job hello
35+
Hello world: sleeping for 3 seconds.
36+
Hello world: sleeping for 3 seconds.
37+
Hello world: sleeping for 3 seconds.
38+
...
39+
```
40+
2241
## Signal Handler
2342

2443
```

example/hello.nomad

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
job "hello" {
2+
datacenters = ["dc1"]
3+
4+
group "hello-group" {
5+
task "hello-task" {
6+
driver = "containerd-driver"
7+
8+
config {
9+
image = "docker.io/shm32/hello:world"
10+
}
11+
12+
resources {
13+
cpu = 500
14+
memory = 256
15+
network {
16+
mbits = 10
17+
}
18+
}
19+
}
20+
}
21+
}

0 commit comments

Comments
 (0)