安裝docker
以ubuntu為例
sudo apt-get install docker.io
設置開機自啟動
sudo systemctl enable docker
安裝Portainer
portainer是一個docker的web管理界面,類似的還有DockerUI,Shipyard。如果不想每次都去控制台輸命令的話,最好安裝一個。
拉取鏡像
sudo docker pull portainer/portainer
創建容器
創建容器,綁定9000端口,然后用瀏覽器打開。初次登陸注冊用戶,然后選擇local連接到本地的docker。
docker run -d -p 9000:9000 --restart=always -v /var/run/docker.sock:/var/run/docker.sock --name portainer portainer/portainer
安裝Nextcloud
在鏡像里面搜索nextcloud然后下載。
![]()
創建容器
轉到portainer的容器界面,添加容器,然后設置端口和持久卷。nextcloud容器數據的路徑是/var/www/html,設置完畢然后deploy container,打開網頁登錄nextcloud。
![]()
/var/www/html
Main folder, needed for updating/var/www/html/custom_apps
installed / modified apps/var/www/html/config
local configuration/var/www/html/data
the actual data of your Nextcloud/var/www/html/themes/<you_custom_theme>
theming/brandingWindows 10 映射WebDav
nextcloud支持webdav,可以在windows中映射為網絡驅動器。要使用這個功能,需要兩個操作。
讓Window支持http訪問webdav,將注冊表HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\WebClient\Parameters下面的鍵值BasicAuthLevel改為2,然后重啟webclient服務。
然后映射網絡驅動器,但是要注意路徑。官方文檔的說明上面給的路徑是https://example.com/nextcloud/remote.php/dav/files/USERNAME/ ,注意路徑中的nextcloud是nextcloud的路徑,使用docker直接裝應該沒有的,例如
http://127.0.0.1/remote.php/dav/files/zhangsan
而且,后面可以繼續跟文件夾的,如果網盤存在這個目錄的話
http://127.0.0.1/remote.php/dav/files/zhangsan/Documents
另外,用這個地址http://example.com/remote.php/webdav/也可以連接上的
http://127.0.0.1/remote.php/webdav/ http://127.0.0.1/remote.php/webdav/Documents
![]()
官方文檔的圖 ![]()