1

I am trying to use a Docker image on Google App Engine Flexible Environment.

FROM ubuntu:bionic MAINTAINER Makina Corpus "[email protected]" ENV PYTHONUNBUFFERED 1 ENV DEBIAN_FRONTEND noninteractive ENV LANG C.UTF-8 RUN apt-get update -qq && apt-get install -y -qq \ # std libs git less nano curl \ ca-certificates \ wget build-essential\ # python basic libs python3.8 python3.8-dev python3.8-venv gettext \ # geodjango gdal-bin binutils libproj-dev libgdal-dev \ # postgresql libpq-dev postgresql-client && \ apt-get clean all && rm -rf /var/apt/lists/* && rm -rf /var/cache/apt/* # install pip RUN wget https://bootstrap.pypa.io/get-pip.py && python3.8 get-pip.py && rm get-pip.py RUN pip3 install --no-cache-dir setuptools wheel -U CMD ["/bin/bash"] 

The docker image appears to build correctly but when the service deploys the application crashes and i get this error message:

 File "/Users/NAME/Documents/gcp/google-cloud-sdk/lib/googlecloudsdk/api_lib/app/operations_util.py", line 183, in IsDone encoding.MessageToPyValue(operation.error))) OperationError: Error Response: [9] Application startup error! Code: APP_CONTAINER_CRASHED ERROR: (gcloud.app.deploy) Error Response: [9] Application startup error! Code: APP_CONTAINER_CRASHED 

This is failing as the Dockerfile is installing a significantly outdated version of the GDAL package which conflicts with the more current python installation.

How do I ensure that the dockerfile has the correct package repository and is installing the right, up to date, versions? Is there some line that I can insert to update the repository, or at least print the repository, before it starts installing?

EDIT:

My app.yaml:

# [START django_app] runtime: custom env: flex entrypoint: gunicorn -b :$PORT MyApplication.wsgi runtime_config: python_version: 3 # [END runtime] handlers: # This configures Google App Engine to serve the files in the app's static # directory. #- url: /static # static_dir: static/ #- url: /MyApplication/static # static_dir: MyApplication/static/ # This handler routes all requests not caught above to your main app. It is # required when static routes are defined, but can be omitted (along with # the entire handlers section) when there are no static files defined. - url: /.* script: auto # [END django_app] resources: cpu: 1 memory_gb: 2 disk_size_gb: 10 

2 Answers 2

1

You App Engine deployment is failing because it needs a service listening on port 8080 and it cannot run bash on the cloud. If you need to debug your App Engine Flex instance, you need to first get a service on port 8080 and then enable SSH.

Sign up to request clarification or add additional context in comments.

3 Comments

If you are using python to serve your traffic it would be a good idea to use the Google Images github.com/GoogleCloudPlatform/python-runtime
Thank you! How do I ensure my Django app is running on 8080? Is this done in the app.yaml (I have edited question to show my file)? Would definitely rather use the google image (i just need to ensure these packages are installed: gdal-bin binutils libproj-dev libgdal-dev). Should I replace 'FROM ubuntu:bionic' with 'from gcr.io/google-appengine/python'?
Given that you will use Django, I would base my work on the docker file in Kubernetes section and incorporate the django parts from this tutorial
0

Similar issues are being tackled here and here

Your Dockerfile should run a command that spins up your application listening on port 8080:

CMD gunicorn -b :$PORT MyApplication.wsgi 

GAE actually spins up containers with docker run and I am not sure why they would also have the entrypoint specified in the app.yaml file. Better not ask too many question with GAE.

Other issues for you to think about as mentioned in some of the comments above:

  • Wouldn't it be better to use Google's GAE base image (as mentioned in some of the comments above) -> FROM gcr.io/google-appengine/python?
  • If so, you need to consider it is based off Ubuntu 16.04 and you need to update dependencies (by adding the UbuntuGIS PPA: add-apt-repository -y ppa:ubuntugis/ppa)
  • How do you install your other dependencies? Running pip using a requirements file?

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.