-
Notifications
You must be signed in to change notification settings - Fork 3.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
docker cp? #2044
Comments
I just found out that the diff service supports capturing the entire snapshot by providing empty lower mounts. upperMounts, err := snapshotService.Mounts(ctx, snapshotKey)
if err != nil {
return err
}
desc, err := diffService.DiffMounts(ctx,
[]mount.Mount{},
upperMounts,
diff.WithMediaType(ocispec.MediaTypeImageLayerGzip),
diff.WithReference("custom-ref"))
fmt.Println(desc.Digest) It would be nice if we could apply a globbing pattern.
|
@pauldotknopf Just mount the snapshot and copy to it. Using $ sudo ctr run -t docker.io/library/busybox:latest test09 /bin/sh # create a container some how
$ sudo ctr snapshot mounts /tmp/mymount test09 | xargs sudo # mount its filesystem
$ rsync -av /mydata /tmp/mymount
$ umount /tmp/mymount You can reproduce this in Go using the snapshot service and the mount helpers. |
Oh, cool, I didn't realize that it was supported to mount from the client. I was trying to avoid root access in my client though. Oh well. Thanks! |
If your client doesn't have permissions to perform the mount, then it won't work. Typically, we recommend that the client be trusted, as it has the ability to execute binaries and enforce policy. You could, of course, do this entirely as a non-privileged user. Just do the copy into a directory, tar that up as a layer and then import into containerd and use the diff service to apply the changes. |
Hi @stevvooe
I am new to containerd APIs and trying to emulate what docker cp does. |
NVM, I figured it out. |
What is the state of downloading/uploading files to containers/snapshots?
Is there some way for the client to get the path to an active snapshot?
Maybe there is a way to create content blobs from an active snapshot and file glob, then I can just download the tar? Same thing in reverse?
The text was updated successfully, but these errors were encountered: