Skip to content

Commit 92ebc28

Browse files
committed
fix tmpfs errors?
Signed-off-by: Arjun Raja Yogidas <[email protected]>
1 parent b536c38 commit 92ebc28

File tree

2 files changed

+6
-9
lines changed

2 files changed

+6
-9
lines changed

cmd/nerdctl/container/container_inspect_linux_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ func TestContainerInspectContainsMounts(t *testing.T) {
6262
"--name", testContainer,
6363
"--network", "none",
6464
"-v", "/anony-vol",
65+
"--tmpfs", "/app1:size=64m",
6566
"--mount", "type=bind,src=/tmp,dst=/app2,ro",
6667
"--mount", fmt.Sprintf("type=volume,src=%s,dst=/app3,readonly=false", testVolume),
6768
testutil.NginxAlpineImage).AssertOK()

pkg/inspecttypes/dockercompat/dockercompat.go

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ type HostConfig struct {
164164
Runtime string // Runtime to use with this container
165165
Devices []string // List of devices to map inside the container
166166
PidMode string // PID namespace to use for the container
167-
Tmpfs []MountPoint `json:",omitempty"` // List of tmpfs (mounts) used for the container
167+
Tmpfs map[string]string `json:"Tmpfs,omitempty"` // List of tmpfs (mounts) used for the container
168168
}
169169

170170
// From https://github.com/moby/moby/blob/v20.10.1/api/types/types.go#L416-L427
@@ -335,22 +335,18 @@ func ContainerFromNative(n *native.Container) (*Container, error) {
335335
}
336336
}
337337

338-
var tmpfsMounts []MountPoint
339-
340338
if nerdctlMounts := n.Labels[labels.Mounts]; nerdctlMounts != "" {
341339
mounts, err := parseMounts(nerdctlMounts)
342340
if err != nil {
343341
return nil, err
344342
}
345343
c.Mounts = mounts
346-
if len(mounts) > 0 {
347-
tmpfsMounts = mounts
348-
// filterTmpfsMounts(mounts)
344+
for _, mount := range mounts {
345+
if mount.Type == "tmpfs" {
346+
c.HostConfig.Tmpfs[mount.Destination] = mount.Mode
347+
}
349348
}
350349
}
351-
// if len(tmpfsMounts) > 0 {
352-
c.HostConfig.Tmpfs = tmpfsMounts
353-
// }
354350

355351
if nedctlExtraHosts := n.Labels[labels.ExtraHosts]; nedctlExtraHosts != "" {
356352
c.HostConfig.ExtraHosts = parseExtraHosts(nedctlExtraHosts)

0 commit comments

Comments
 (0)