在Docker中使用Protobuf的Python“TypeError:无法将原始文件构build到描述符池中!

我有一个使用协议缓冲区的Python应用程序。 我试图让它在Docker中运行,但是当我执行docker run时它抛出一个错误:

这里是Dockerfile的内容:

  FROM python:3.5-onbuild CMD [ "python", "./main.py" ] 

这是错误:

 bash-3.2$ docker run gcr.io/skroot-com/geo-boundary-refiner:0.1 Traceback (most recent call last): File "./main.py", line 14, in <module> from skroot.schema.pipeline.event import geo_boundary_marked_pb2 File "/usr/src/app/skroot/schema/pipeline/event/geo_boundary_marked_pb2.py", line 18, in <module> from skroot.schema.pipeline import image_info_pb2 as skroot_dot_schema_dot_pipeline_dot_image__info__pb2 File "/usr/src/app/skroot/schema/pipeline/image_info_pb2.py", line 26, in <module> dependencies=[skroot_dot_schema_dot_pipeline_dot_cloud__storage__location__pb2.DESCRIPTOR,skroot_dot_schema_dot_pipeline_dot___matrix__pb2.DESCRIPTOR,]) File "/usr/local/lib/python3.5/site-packages/google/protobuf/descriptor.py", line 829, in __new__ return _message.default_pool.AddSerializedFile(serialized_pb) TypeError: Couldn't build proto file into descriptor pool! Invalid proto descriptor for file "image_info.proto": image_info.proto: Import "skroot/schema/pipeline/cloud_storage_location.proto" has not been loaded. image_info.proto: Import "skroot/schema/pipeline/matrix.proto" has not been loaded. skroot.schema.pipeline.ImageInfo.Image.location: "skroot.schema.pipeline.CloudStorageLocation" seems to be defined in "cloud_storage_location.proto", which is not imported by "image_info.proto". To use it here, please add the necessary import. skroot.schema.pipeline.ImageInfo.TranscodedImage.matrix: "skroot.schema.pipeline.Matrix" seems to be defined in "matrix.proto", which is not imported by "image_info.proto". To use it here, please add the necessary import. 

image_info.proto文件中,它所抱怨的.proto文件被导入:

 import "skroot/schema/pipeline/cloud_storage_location.proto"; import "skroot/schema/pipeline/matrix.proto"; 

生成的protobuf文件位于skroot/schema/pipeline/目录中。

我感到困惑,因为这在本地运行。 只有当我尝试在Docker中运行它时,才会出现这些错误。