Xgo Cgofuse Docker Image
使用xgo对依赖cgofuse的程序进行交叉编译的Docker镜像,支持Windows、macOS和Linux平台。
Cross-platform FUSE library for Go
https://godoc.org/github.com/billziss-gh/cgofuse/fuse
https://godoc.org/github.com/billziss-gh/cgofuse/fusehttps://godoc.org/github.com/billziss-gh/cgofuse/fusehttps://godoc.org/github.com/billziss-gh/cgofuse/fusehttps://golang.org/cmd/cgo/ and https://github.com/golang/go/wiki/WindowsDLLs ("nocgo") variants depending on the platform.
| Windows | macOS | Linux | FreeBSD | NetBSD* | OpenBSD* | XGO | |
|---|---|---|---|---|---|---|---|
| cgo | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |
| !cgo | ✓ |
* NetBSD and OpenBSD support is experimental. There are known issues that stem from the differences in the NetBSD https://github.com/NetBSD/src/tree/bbc46b99bff565d75f55fb23b51eff511068b183/lib/librefuse and OpenBSD https://github.com/openbsd/src/tree/dae5ffec5618b0b660e9064e3b0991bb4ab1b1e8/lib/libfuse implementations from the reference https://github.com/libfuse/libfuse implementation
How to build
Windows cgo
- Prerequisites: https://github.com/billziss-gh/winfsp, gcc (e.g. from Mingw-builds)
- Build:
> cd cgofuse > set CPATH=C:\Program Files (x86)\WinFsp\inc\fuse > go install -v ./fuse ./examples/memfs
Windows !cgo
- Prerequisites: https://github.com/billziss-gh/winfsp
- Build:
> cd cgofuse > set CGO_ENABLED=0 > go install -v ./fuse ./examples/memfs
macOS
- Prerequisites: [***] https://developer.apple.com/library/content/technotes/tn2339/_index.html
- Build:
$ cd cgofuse $ go install -v ./fuse ./examples/memfs ./examples/passthrough
Linux
- Prerequisites: libfuse-dev, gcc
- Build:
$ cd cgofuse $ go install -v ./fuse ./examples/memfs ./examples/passthrough
FreeBSD
- Prerequisites: fusefs-libs
- Build:
$ cd cgofuse $ go install -v ./fuse ./examples/memfs ./examples/passthrough # You may also need the following in order to run FUSE file systems. # Commands must be run as root. $ vi /boot/loader.conf # add: fuse_load="YES" $ sysctl vfs.usermount=1 # allow user mounts $ pw usermod USERNAME -G operator # allow user to open /dev/fuse
NetBSD
- Prerequisites: NONE
- Build:
$ cd cgofuse $ go install -v ./fuse ./examples/memfs ./examples/passthrough # You may also need the following in order to run FUSE file systems. # Commands must be run as root. $ chmod go+rw /dev/puffs $ sysctl -w vfs.generic.usermount=1
OpenBSD
- Prerequisites: NONE
- Build:
$ cd cgofuse $ go install -v ./fuse ./examples/memfs ./examples/passthrough - NOTE: OpenBSD 6 removed the
kern.usermountoption, which allowed non-root users to mount file systems [link]. Therefore you must be root in order to use FUSE and cgofuse.
How to cross-compile your project using xgo
You can easily cross-compile your project using https://github.com/karalabe/xgo and the https://hub.docker.com/r/billziss/xgo-cgofuse/ docker image.
- Prerequisites: [***] https://github.com/karalabe/xgo
- Build:
$ docker pull billziss/xgo-cgofuse $ go get -u github.com/karalabe/xgo $ cd YOUR-PROJECT-THAT-USES-CGOFUSE $ xgo --image=billziss/xgo-cgofuse \ --targets=darwin/386,darwin/amd64,linux/386,linux/amd64,windows/386,windows/amd64 .
Cross-compilation only works for Windows, macOS and Linux.
How to use
User mode file systems are expected to implement fuse.FileSystemInterface. To make implementation simpler a file system can embed ("inherit") a fuse.FileSystemBase which provides default implementations for all operations. To mount a file system one must instantiate a fuse.FileSystemHost using fuse.NewFileSystemHost.
The full documentation is available at GoDoc.org: https://godoc.org/github.com/billziss-gh/cgofuse/fuse
There are currently three example file systems:
- Hellofs is an extremely simple file system. Runs on all OS'es.
- Memfs is an in memory file system. Runs on all OS'es.
- Passthrough is a file system that passes all operations to the underlying file system. Runs on all OS'es except Windows.
How it is tested
Cgofuse is regularly built and tested on https://travis-ci.org/billziss-gh/cgofuse, https://ci.appveyor.com/project/billziss-gh/cgofuse and https://hub.docker.com/r/billziss/xgo-cgofuse. The following software is being used to test cgofuse.
Windows (cgo and !cgo)
- https://github.com/billziss-gh/winfsp/tree/master/tst/winfsp-tests
- https://github.com/billziss-gh/secfs.test/tree/master/fstools/src/fsx
macOS
- https://github.com/billziss-gh/secfs.test/tree/master/fstest/ntfs-3g-pjd-fstest-8af5670
- https://github.com/billziss-gh/secfs.test/tree/master/fstools/src/fsx
Linux
- https://github.com/billziss-gh/secfs.test/tree/master/fstest/ntfs-3g-pjd-fstest-8af5670
- https://github.com/billziss-gh/secfs.test/tree/master/fstools/src/fsx
FreeBSD
- https://github.com/billziss-gh/secfs.test/tree/master/fstools/src/fsx
Contributors
- Bill Zissimopoulos <billziss at navimatics.com>
- Nick Craig-Wood <nick at craig-wood.com>
- Fredrik Medley <fredrik.medley at veoneer.com>
镜像拉取方式
您可以使用以下命令拉取该镜像。请将 <标签> 替换为具体的标签版本。如需查看所有可用标签版本,请访问 标签列表页面。
轩辕镜像加速拉取命令点我查看更多 xgo-cgofuse 镜像标签
DockerHub 原生拉取命令
用户好评
来自真实用户的反馈,见证轩辕镜像的优质服务