关于 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 运行带有 sudocopy 命令,则在某些情况下,复制操作可能无法向源机器进行身份验证。出现此问题的原因是 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

如需解决此问题,请尝试使用不含 sudogcloud 运行 copy 命令。

使用快照版本的 Docker 时,analyze 命令失败

如果您使用的是快照版本的 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