Hey Guys,
So I've built my dockerfile which makes a simple website.
The build succeeds in Docker local and in Cloud Build. But when It goes to step 2: push it fails.
The logs:
Can you explain a bit more about how you received this error? Which was the command you ran to push the Docker image to GCP? Are you using a Cloud Build configuration file (cloudbuild.yaml) that you can share to replicate the issue?
For your reference, the documentation provides starter guides to push images to both Artifact Registry and Container Registry.
Hi @ErnestoC ,
My apologies for the late reply,
I've built a docker image so that I can host my website on Cloud Run. Hereby my steps te replicate the problem.
- Create an Cloud Run instance
- Give it a name
- Select Europe-west4 region
- Select Continuous deployment from a source repository
- Setup with Cloud Build
- Repository builder : Github
- Select private repository(already authenticated)
- Select Main branch
- Select Dockerfile
- Fill in /Dockerfile
- Save
- Minimal of 1 instance
- Allow unauthenticated invocations
- Listen to port 80
- Create
When I do these steps the instance gets created and after 30 seconds I get the error from Cloud build. I've tried it again and again, but the same result over multiple days.
Dockerfile:
FROM ubuntu/apache2
COPY script /var
RUN chmod +x /var/script
RUN /var/script
COPY /src/html /var/www/html
COPY /src/certificates /var/certificates
RUN service apache2 restart
My script:
#!bin/bash
apt update
apt install software-properties-common -y
add-apt-repository ppa:ondrej/php
apt update
apt install php8.0 -y
apt install php8.0-mysqli -y
rm -rf /var/www/html/*
rm /etc/apache2/sites-available/000-default.conf
rm /etc/apache2/sites-available/default-ssl.conf
a2dissite 000-default.conf
cat > /etc/apache2/sites-available/<private>.nl.conf << EOF
<VirtualHost *:80>
ServerAdmin<private>
Servername <private>
ServerAlias <private
DocumentRoot /var/www/html/
DirectoryIndex index.php
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</Virtualhost>
EOF
a2ensite site.conf
a2enmod rewrite
Thank you in advance for taking a look at my question.
Since there are multiple internal details about your pipeline that would need to be taken into account, the best way to proceed would be to create a support case directly with GCP. This so your project can be internally reviewed and you can get an accurate analysis.
We have the exact same issue. We use cloudbuild to push images to gcr.io.
We recently changed from gcr.io to explixitly use eu.gcr.io, and ever since, some of our cloudbuild jobs fail. The URL change is the only one we made in our cloudbuild jobs.