Cannot Containerize The Sample App In Google Kubernetes Tutorial

1/14/2019

I can't containerize the sample application provided by Google, which means it's either a global issue or something really obvious I'm overlooking.

So. I'm working from the Google PHP Bookshelf Tutorial at https://cloud.google.com/php/tutorials/bookshelf-on-kubernetes-engine with the default Dockerfile, which is to say:

FROM gcr.io/google_appengine/php

# Add our NGINX and php.ini config
ENV DOCUMENT_ROOT=${APP_DIR}/web

# Workaround for AUFS-related permission issue:
# See https://github.com/docker/docker/issues/783#issuecomment-56013588
RUN cp -R ${APP_DIR} ${APP_DIR}-copy; rm -r ${APP_DIR}; mv ${APP_DIR}-copy ${APP_DIR}; chmod -R 550 ${APP_DIR}; chown -R root.www-data ${APP_DIR}

And when I run this command in the directory:

docker build -t gcr.io/{ID}/bookshelf .

I get the following error message that bombs out:

Get:19 http://packages.cloud.google.com/apt gcp-php-runtime-xenial-20181210-1/main amd64 gcp-php72-stackdriver-debugger amd64 0.2.0-7.2.13-1 [16.3 kB]
Fetched 13.1 MB in 3s (3762 kB/s)
W: http://packages.cloud.google.com/apt/pool/gcp-php72-cassandra_1.3.2-7.2.13-1_amd64_ada32d7a11b6c82aaa6b1ac862ef703f9b7fe1c16f640b695465a64457cd4aa4.deb: Automatically disabled Acquire::http::Pipeline-Depth due to incorrect response from server/proxy. (man 5 apt.conf)
E: Failed to fetch http://packages.cloud.google.com/apt/pool/gcp-php72-apcu_5.1.15-7.2.13-1_amd64_15fbd2c2e40acf5c27e025da6a2a91bae6c5d91474e2bc1d6701a38e1694b141.deb  400  Bad Request

E: Failed to fetch http://packages.cloud.google.com/apt/pool/gcp-php72-apcu-bc_1.0.4-7.2.13-1_amd64_2df44251c7d74210da6f81d5008759ae05c6a7508bd867641c3e2a5d09c37023.deb  405  Method Not Allowed

E: Failed to fetch http://packages.cloud.google.com/apt/pool/gcp-php72-cassandra_1.3.2-7.2.13-1_amd64_ada32d7a11b6c82aaa6b1ac862ef703f9b7fe1c16f640b695465a64457cd4aa4.deb  Hash Sum mismatch

E: Failed to fetch http://packages.cloud.google.com/apt/pool/gcp-php72-ev_1.0.4-7.2.13-1_amd64_7070488b0e864419786e936ecb37a1db16b8da2ffe7bb6d477de6efd17fb6033.deb  Hash Sum mismatch

E: Failed to fetch http://packages.cloud.google.com/apt/pool/gcp-php72-event_2.4.3-7.2.13-1_amd64_43ac00ba31d1d0ef2fb882ea1ea8e7734153e764a083547b4670febde058ec18.deb  Hash Sum mismatch

E: Failed to fetch http://packages.cloud.google.com/apt/pool/gcp-php72-grpc_1.17.0-7.2.13-1_amd64_bdd2d379362ab3f30d1360059d73d216ba14e1602ee0e4dd57981da14a7fb08f.deb  Hash Sum mismatch

E: Failed to fetch http://packages.cloud.google.com/apt/pool/gcp-php72-imagick_3.4.3-7.2.13-1_amd64_5ade1cea82cf4ac52e7c999e5a93239f12fba76ecf9865a7ad7e9f0fdbd142bd.deb  Writing more data than expected (91276 > 85662)

E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?

The command '/bin/sh -c /build-scripts/composer.sh' returned a non-zero code: 100

This error occurs whenever I try to run the build anywhere - even if I do a test on my local machine, it still bombs.

What gives?

-- Ferrett Steinmetz
google-app-engine
google-cloud-platform
google-kubernetes-engine

1 Answer

1/14/2019

The apt errors Hash Sum mismatch, 400 Bad Request, 405 Method Not Allowed, Writing more data than expected (91276 > 85662) suggest that something was wrong with the apt package repos at that time.

So I am assuming something was broken with the repo at that time (OR a partial response was received due to a blip in networking which might have caused APT to express these errors).

I have now built the Dockerfile of this tutorial successfully. So I think this was a transient issue.

-- AhmetB - Google
Source: StackOverflow