Skip to content
This repository was archived by the owner on Jul 18, 2025. It is now read-only.

Commit 75aa91a

Browse files
authored
Merge pull request #403 from joshwget/tmpfs-options
Support options for tmpfs
2 parents 0e7e65f + 87ba7d2 commit 75aa91a

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

docker/service/convert.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,12 @@ func Convert(c *config.ServiceConfig, ctx project.Context, clientFactory compose
239239

240240
tmpfs := map[string]string{}
241241
for _, path := range c.Tmpfs {
242-
tmpfs[path] = ""
242+
split := strings.SplitN(path, ":", 2)
243+
if len(split) == 1 {
244+
tmpfs[split[0]] = ""
245+
} else if len(split) == 2 {
246+
tmpfs[split[0]] = split[1]
247+
}
243248
}
244249

245250
hostConfig := &container.HostConfig{

docker/service/convert_test.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,4 +171,14 @@ func TestTmpfs(t *testing.T) {
171171
assert.True(t, reflect.DeepEqual(map[string]string{
172172
"/run": "",
173173
}, hostCfg.Tmpfs))
174+
175+
sc = &config.ServiceConfig{
176+
Tmpfs: yaml.Stringorslice{"/run:rw,noexec,nosuid,size=65536k"},
177+
}
178+
_, hostCfg, err = Convert(sc, ctx.Context, nil)
179+
assert.Nil(t, err)
180+
181+
assert.True(t, reflect.DeepEqual(map[string]string{
182+
"/run": "rw,noexec,nosuid,size=65536k",
183+
}, hostCfg.Tmpfs))
174184
}

0 commit comments

Comments
 (0)