〇rcloneの構築方法
docker build -t rclone .
Dockerfile
FROM alpine:3.7
WORKDIR /
RUN apk update \
&& apk add --no-cache curl \
&& curl -O https://downloads.rclone.org/rclone-current-linux-amd64.zip \
&& unzip rclone-current-linux-amd64.zip \
&& cp rclone-*-linux-amd64/rclone /usr/bin \
&& rm -rf /tmp/* /var/tmp/* /var/cache/apk/*
VOLUME /opt/rclone
CMD ["/bin/sh"]
〇rclone設定
以下のコマンドを実行します。
docker run -v `pwd`:/opt/rclone --rm -i -t rclone /usr/bin/rclone --config=/opt/rclone/rclone.config config
以下の例ではIPアドレス192.168.1.250のnextcloudを登録した例です。
No remotes found - make a new one
n) New remote
s) Set configuration password
q) Quit config
n/s/q> n
name> nextcloud ※アクセス先として使用する名称を指定
Type of storage to configure.
Choose a number from below, or type in your own value
1 / Alias for a existing remote
\ "alias"
2 / Amazon Drive
\ "amazon cloud drive"
3 / Amazon S3 Compliant Storage Providers (AWS, Ceph, Dreamhost, IBM COS, Minio)
\ "s3"
4 / Backblaze B2
\ "b2"
5 / Box
\ "box"
6 / Cache a remote
\ "cache"
7 / Dropbox
\ "dropbox"
8 / Encrypt/Decrypt a remote
\ "crypt"
9 / FTP Connection
\ "ftp"
10 / Google Cloud Storage (this is not Google Drive)
\ "google cloud storage"
11 / Google Drive
\ "drive"
12 / Hubic
\ "hubic"
13 / Local Disk
\ "local"
14 / Mega
\ "mega"
15 / Microsoft Azure Blob Storage
\ "azureblob"
16 / Microsoft OneDrive
\ "onedrive"
17 / OpenDrive
\ "opendrive"
18 / Openstack Swift (Rackspace Cloud Files, Memset Memstore, OVH)
\ "swift"
19 / Pcloud
\ "pcloud"
20 / QingCloud Object Storage
\ "qingstor"
21 / SSH/SFTP Connection
\ "sftp"
22 / Webdav
\ "webdav"
23 / Yandex Disk
\ "yandex"
24 / http Connection
\ "http"
Storage> webdav
URL of http host to connect to
Choose a number from below, or type in your own value
1 / Connect to example.com
\ "https://example.com"
url> http://192.168.1.250 ※webdavのホスト名を指定
Name of the Webdav site/service/software you are using
Choose a number from below, or type in your own value
1 / Nextcloud
\ "nextcloud"
2 / Owncloud
\ "owncloud"
3 / Sharepoint
\ "sharepoint"
4 / Other site/service or software
\ "other"
vendor> 1
User name
user> admin ※webdav接続するユーザ名
Password. ※webdav接続するパスワード
y) Yes type in my own password
g) Generate random password
n) No leave this optional password blank
y/g/n> y
Enter the password:
password:
Confirm the password:
password:
Remote config
--------------------
[nextcloud]
type = webdav
url = http://192.168.1.250
vendor = nextcloud
user = admin
pass = *** ENCRYPTED ***
--------------------
y) Yes this is OK
e) Edit this remote
d) Delete this remote
y/e/d> y
Current remotes:
Name Type
==== ====
nextcloud webdav
e) Edit existing remote
n) New remote
d) Delete remote
r) Rename remote
c) Copy remote
s) Set configuration password
q) Quit config
e/n/d/r/c/s/q> q
〇ファイルの列挙
以下のコマンドを実行します。
docker run -v `pwd`:/opt/rclone -i -t rclone /usr/bin/rclone --config=/opt/rclone/rclone.config ls nextcloud:/nextcloud/remote.php/dav/files/admin/
※「:」前のnextcloudの部分はconfigで登録した名称になります。※adminの部分はユーザ名によって変更します
〇ファイルの同期
以下の例ではコンテナローカルの/opt/rclone(ホストの現フォルダにマウント)とnextcloudのフォルダ間でコピーします。
docker run -v `pwd`:/opt/rclone --rm -i -t rclone /usr/bin/rclone --config=/opt/rclone/rclone.config sync /opt/rclone nextcloud:/nextcloud/remote.php/dav/files/admin/
○関連情報
・Nextcloudに関する他の記事はこちらを参照してください。
0 件のコメント:
コメントを投稿