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

Commit 87ba7d2

Browse files
committed
Support options for tmpfs
Signed-off-by: Josh Curl <[email protected]>
1 parent c0bb633 commit 87ba7d2

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
@@ -142,4 +142,14 @@ func TestTmpfs(t *testing.T) {
142142
assert.True(t, reflect.DeepEqual(map[string]string{
143143
"/run": "",
144144
}, hostCfg.Tmpfs))
145+
146+
sc = &config.ServiceConfig{
147+
Tmpfs: yaml.Stringorslice{"/run:rw,noexec,nosuid,size=65536k"},
148+
}
149+
_, hostCfg, err = Convert(sc, ctx.Context, nil)
150+
assert.Nil(t, err)
151+
152+
assert.True(t, reflect.DeepEqual(map[string]string{
153+
"/run": "rw,noexec,nosuid,size=65536k",
154+
}, hostCfg.Tmpfs))
145155
}

0 commit comments

Comments
 (0)