dockerfile:
FROM node:10
ADD . /app
WORKDIR /app
COPY package*.json ./
RUN npm install
COPY . .
EXPOSE 3000
CMD [ "node", "index.js" ]
cloudbuild.yaml:
steps:
- name: buildcontainer
args: ['build', '-t', 'gcr.io/$PROJECT_ID/coffee2goserver:${SHORT_SHA}', '.']
- name: 'pushcontainer'
args: ["push", "gcr.io/$PROJECT_ID/coffee2goserver"]
error:
Error response from daemon: pull access denied for buildcontainer, repository does not exist or may require 'docker login'
Google Cloud Build doesn't provide any buildcontainer or pushcontainer images you can use in your builds (unless you have created them yourself).
You may use the official Docker image in your step like so:
steps:
- name: docker
args: ['build', '-t', 'gcr.io/$PROJECT_ID/coffee2goserver:${SHORT_SHA}', '.']
- name: docker
args: ["push", "gcr.io/$PROJECT_ID/coffee2goserver:${SHORT_SHA}"]
The Docker build step is automatically set up with credentials for your Cloud Build Service Account. These permissions are sufficient to interact directly with GCR.
Also, as David Maze@ mentioned in his comment, be careful to push your image with the same name it was build with, including the ${SHORT_SHA} in this case.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With