Skip to content

Commit

Permalink
resolves #14 add support for bind mounts
Browse files Browse the repository at this point in the history
  • Loading branch information
slonopotamus committed Sep 25, 2023
1 parent 621cb9d commit 170cfe1
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.adoc
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
= Changelog
:icons: font

== Unreleased

- Add support for bind mounts

== 0.0.1

Initial release
16 changes: 16 additions & 0 deletions containerd/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,22 @@ func (s *service) Create(ctx context.Context, request *taskAPI.CreateTaskRequest
})
}

for _, m := range spec.Mounts {
if m.Type == "bind" {
stat, err := os.Stat(m.Source)
if err == nil && stat.IsDir() {
mounts = append(mounts, mount.Mount{
Type: m.Type,
Source: m.Source,
Target: m.Destination,
Options: m.Options,
})
continue
}
}
log.L.Warn("skipping mount: ", m)
}

if err = mount.All(mounts, c.rootfs); err != nil {
return nil, fmt.Errorf("failed to mount rootfs component: %w", err)
}
Expand Down

0 comments on commit 170cfe1

Please sign in to comment.