docs: factor large docs into separate .md files to make them easier to maintain.
We then use the go embed command to embed them back into the binary.
This commit is contained in:
parent
e67157cf46
commit
831d1df67f
8 changed files with 164 additions and 178 deletions
|
@ -3,8 +3,8 @@ package docker
|
|||
|
||||
import (
|
||||
"context"
|
||||
_ "embed"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
"syscall"
|
||||
|
||||
"github.com/spf13/cobra"
|
||||
|
@ -30,6 +30,9 @@ var (
|
|||
noSpec = false
|
||||
)
|
||||
|
||||
//go:embed docker.md
|
||||
var longHelp string
|
||||
|
||||
func init() {
|
||||
cmdFlags := Command.Flags()
|
||||
// Add command specific flags
|
||||
|
@ -47,7 +50,7 @@ func init() {
|
|||
var Command = &cobra.Command{
|
||||
Use: "docker",
|
||||
Short: `Serve any remote on docker's volume plugin API.`,
|
||||
Long: strings.ReplaceAll(longHelp, "|", "`") + vfs.Help,
|
||||
Long: longHelp + vfs.Help,
|
||||
Annotations: map[string]string{
|
||||
"versionIntroduced": "v1.56",
|
||||
"groups": "Filter",
|
||||
|
|
|
@ -1,7 +1,3 @@
|
|||
package docker
|
||||
|
||||
// Note: "|" will be replaced by backticks
|
||||
var longHelp = `
|
||||
This command implements the Docker volume plugin API allowing docker to use
|
||||
rclone as a data storage mechanism for various cloud providers.
|
||||
rclone provides [docker volume plugin](/docker) based on it.
|
||||
|
@ -12,32 +8,31 @@ docker daemon and runs the corresponding code when necessary.
|
|||
Docker plugins can run as a managed plugin under control of the docker daemon
|
||||
or as an independent native service. For testing, you can just run it directly
|
||||
from the command line, for example:
|
||||
|||
|
||||
```
|
||||
sudo rclone serve docker --base-dir /tmp/rclone-volumes --socket-addr localhost:8787 -vv
|
||||
|||
|
||||
```
|
||||
|
||||
Running |rclone serve docker| will create the said socket, listening for
|
||||
Running `rclone serve docker` will create the said socket, listening for
|
||||
commands from Docker to create the necessary Volumes. Normally you need not
|
||||
give the |--socket-addr| flag. The API will listen on the unix domain socket
|
||||
at |/run/docker/plugins/rclone.sock|. In the example above rclone will create
|
||||
a TCP socket and a small file |/etc/docker/plugins/rclone.spec| containing
|
||||
the socket address. We use |sudo| because both paths are writeable only by
|
||||
give the `--socket-addr` flag. The API will listen on the unix domain socket
|
||||
at `/run/docker/plugins/rclone.sock`. In the example above rclone will create
|
||||
a TCP socket and a small file `/etc/docker/plugins/rclone.spec` containing
|
||||
the socket address. We use `sudo` because both paths are writeable only by
|
||||
the root user.
|
||||
|
||||
If you later decide to change listening socket, the docker daemon must be
|
||||
restarted to reconnect to |/run/docker/plugins/rclone.sock|
|
||||
or parse new |/etc/docker/plugins/rclone.spec|. Until you restart, any
|
||||
restarted to reconnect to `/run/docker/plugins/rclone.sock`
|
||||
or parse new `/etc/docker/plugins/rclone.spec`. Until you restart, any
|
||||
volume related docker commands will timeout trying to access the old socket.
|
||||
Running directly is supported on **Linux only**, not on Windows or MacOS.
|
||||
This is not a problem with managed plugin mode described in details
|
||||
in the [full documentation](https://rclone.org/docker).
|
||||
|
||||
The command will create volume mounts under the path given by |--base-dir|
|
||||
(by default |/var/lib/docker-volumes/rclone| available only to root)
|
||||
and maintain the JSON formatted file |docker-plugin.state| in the rclone cache
|
||||
The command will create volume mounts under the path given by `--base-dir`
|
||||
(by default `/var/lib/docker-volumes/rclone` available only to root)
|
||||
and maintain the JSON formatted file `docker-plugin.state` in the rclone cache
|
||||
directory with book-keeping records of created and mounted volumes.
|
||||
|
||||
All mount and VFS options are submitted by the docker daemon via API, but
|
||||
you can also provide defaults on the command line as well as set path to the
|
||||
config file and cache directory or adjust logging verbosity.
|
||||
`
|
Loading…
Add table
Add a link
Reference in a new issue