Process got killed when building docker image on GCP
I am a newbie of cloud computing and struggling to deploy my web app on google cloud platform for the first time. When I was building docker image, which means I ran the following code
docker build -t gcr.io/${PROJECT_ID}/insurance-streamlit:v1 .

the process got killed, showing the following error:
Killed
The command '/bin/sh -c pip install -r requirements.txt' returned a non-zero code: 137

I guessed my app might be too large because the weight file has been more than 100MB. So is there a way to fix it? Please tell me the details, thanks in advance!
PS: my Dockerfile is as below:
FROM python:3.7
RUN pip install virtualenv
ENV VIRTUAL_ENV=/venv
RUN virtualenv venv -p python3
ENV PATH=&quot;VIRTUAL_ENV/bin:$PATH&quot;

WORKDIR /app
ADD . /app

# Install dependencies
RUN pip install -r requirements.txt

# copying all files over
COPY . /app

# Expose port 
ENV PORT 8501

# cmd to launch app when container is run
CMD streamlit run app.py

# streamlit-specific commands for config
ENV LC_ALL=C.UTF-8
ENV LANG=C.UTF-8
RUN mkdir -p /root/.streamlit
RUN bash -c 'echo -e &quot;\
[general]\n\
email = \&quot;\&quot;\n\
&quot; &gt; /root/.streamlit/credentials.toml'

RUN bash -c 'echo -e &quot;\
[server]\n\
enableCORS = false\n\
&quot; &gt; /root/.streamlit/config.toml

And my requirements.txt is like:
albumentations==0.4.5
numpy==1.19.0
opencv-python==4.1.0.25
opencv-python-headless==4.2.0.34
pandas==1.0.5
Pillow==7.1.2
streamlit==0.62.0
torch==1.4.0
torchvision==0.5.0
matplotlib


I found that to build your Docker image you should have enough disk space and Python 3.7 installed, also there's a typo at your Docker file - no single quotes ' at the end of the last string. Beside of that, everything looks good and runs.
Please find my steps below:

Enable Google Container Registry API

Create VM instance:


gcloud compute instances create instance-4 --zone=europe-west3-a --machine-type=e2-medium --image=ubuntu-1804-bionic-v20200701 --image-project=ubuntu-os-cloud --boot-disk-size=50GB 


Follow documentation Pushing and pulling images.
Install Python 3.7:

sudo apt install python3.7


Build Docker image:

docker build -t gcr.io/test-prj/testimage:v1 .
...
Step 16/16 : RUN bash -c 'echo -e &quot;[server]\nenableCORS = false\n&quot; &gt; /root/.streamlit/config.toml
 ---&gt; Running in 57502f97cfbe
/bin/sh: 1: Syntax error: Unterminated quoted string
The command '/bin/sh -c bash -c 'echo -e &quot;[server]\nenableCORS = false\n&quot; &gt; /root/.streamlit/config.toml' returned a non-zero code: 2


Change last string of the Docker file:

&quot; &gt; /root/.streamlit/config.toml'


Build Docker image again:

docker build -t gcr.io/test-prj/testimage:v1 .
...
Step 16/16 : RUN bash -c 'echo -e &quot;[server]\nenableCORS = false\n&quot; &gt; /root/.streamlit/config.toml'
 ---&gt; Running in c1c1f81a2d09
Removing intermediate container c1c1f81a2d09
 ---&gt; 24b6609de554
Successfully built 24b6609de554
Successfully tagged gcr.io/test-prj/testimage:v1
$ docker images
REPOSITORY                            TAG                 IMAGE ID            CREATED             SIZE
gcr.io/test-prj/testimage             v1                  24b6609de554        14 minutes ago      3.87GB


Push Docker image to the registry:

gcloud docker -- push gcr.io/test-prj/testimage:v1


Create new VM instance and deploy image:

gcloud compute instances create-with-container instance-5 --zone=europe-west3-a --machine-type=e2-medium --image=cos-stable-81-12871-148-0 --image-project=cos-cloud --boot-disk-size=50GB --container-image=gcr.io/test-prj/testimage:v1 


Check status of Docker container:

instance-5 ~ $ docker ps
CONTAINER ID        IMAGE                                 COMMAND                  CREATED             STATUS                                  PORTS               NAMES
e21b80dc0de7        gcr.io/test-prj/testimage:v1   &quot;/bin/sh -c 'streaml…&quot;   28 seconds ago      Restarting (2) Less than a second ago                       klt-instance-5-caqx

and it doesn't look very good.

Stop container:

instance-5 ~ $docker stop e21b80dc0de7


Follow the documentation and run container interactively:

instance-5 ~ $docker run --name test -it gcr.io/test-prj/testimage:v1
Usage: streamlit run [OPTIONS] TARGET [ARGS]...

Error: Invalid value: File does not exist: app.py

no surprise because I don't have app.py.
After that, I've added some dummy app.py, rebuild and finally it works:
instance-6 ~ $ docker ps
CONTAINER ID        IMAGE                                 COMMAND                  CREATED             STATUS              PORTS               NAMES
1de2e8ded5d8        gcr.io/test-prj/testimage:v2   &quot;/bin/sh -c 'streaml…&quot;   7 minutes ago       Up 7 minutes                           klt-instance-6-yezv

