pip install google-cloud-pubsub fails install in docker container

前端 未结 3 873
南旧
南旧 2021-01-28 00:35

I am trying to use a pupsub emulator. It starts but when I try to use my python script I get the following error

ModuleNotFoundError: No module named \'google\'
         


        
3条回答
  •  误落风尘
    2021-01-28 01:17

    I'm not sure why you're trying to install python3 & pip3, they both exist in the base image. In any case, this Dockerfile will give you the python google-cloud-pubsub libraries in a nice clean image

    FROM google/cloud-sdk:alpine
    
    RUN apk add --no-cache --virtual .build-deps \
        linux-headers build-base g++ python3-dev \
        && pip3 install --no-cache-dir google-cloud-pubsub \
        && apk del .build-deps
    
    # add your stuff here
    

提交回复
热议问题