Migrate to Containers CLI 相關問題
本文說明使用 Migrate to Containers CLI 時可能遇到的某些問題的解決方法。
因權限錯誤導致複製作業失敗
如要取得整個檔案系統的讀取權限,請在來源電腦上使用超級使用者執行 copy
指令。不過,有時複製作業仍會因權限錯誤而失敗。發生這個問題的原因是,在某些情況下,即使是超級使用者也無法讀取來源電腦上的某些目錄。
在這種情況下,您可能會看到類似以下的錯誤訊息:
E rsync rsync: send_files failed to open "/var/lib/lxcfs/cgroup/blkio/blkio.reset_stats": Permission denied (13)
...
E rsync rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1865) [generator=3.2.7]
Error: failed to copy fs from GCP VM "petclinic-springboot": failed copying vm to "/tmp/copy-1411243774": exit status 23
如要解決這個問題,請建立自訂篩選器,將這些目錄排除在複製作業範圍之外。
舉例來說,如要從複製作業中排除 /var/lib/lxcfs
目錄,請在篩選器檔案中新增下列自訂篩選器:
- /var/lib/lxcfs
詳情請參閱「縮減複製的檔案系統大小」。
使用 gcloud
的複製作業無法對機器進行驗證
如果您使用 gcloud
搭配 sudo
執行 copy
指令,在某些情況下,複製作業可能無法向來源機器進行驗證。發生這個問題的原因是,gcloud
會與執行「Migrate to Containers」CLI 的超級使用者一起執行,而超級使用者沒有標準使用者的憑證。
在這種情況下,您可能會看到類似以下的錯誤訊息:
E ssh init ERROR: (gcloud.compute.ssh) There was a problem refreshing your current auth tokens: ('Failed to retrieve TOKEN from the Google Compute Engine metadata service. Status: 404 Response:\nb\'"No service account scopes specified."\'', <google.auth.transport.requests._Response object at 0x7fecf5c75550>)
E ssh init Please run:
E ssh init
E ssh init $ gcloud auth login
E ssh init
E ssh init to obtain new credentials.
E ssh init
E ssh init If you have already logged in with a different account:
E ssh init
E ssh init $ gcloud config set account ACCOUNT
E ssh init
E ssh init to select an already authenticated account to use.
Error: failed to initiate a connection with GCP VM "tomcat-server": exit status 1
如要解決這個問題,請嘗試使用 gcloud
執行 copy
指令,但不要使用 sudo
。
使用 Snap 版本的 Docker 時,analyze
指令會失敗
如果您使用的是 Snap 版本的 Docker,則 analyze
指令會失敗。
在這種情況下,您可能會看到類似以下的錯誤訊息:
I Unpacking file system...
I Running analysis...
Error: running analysis failed: failed to run container: Error response from daemon: invalid mount config for type "bind": bind source path does not exist: PATH
如要解決這個問題,請在不使用 Snap 的情況下重新安裝 Docker。詳情請參閱「安裝 Docker Engine」。