简体   繁体   中英

How to pull/run container when build is finished?

I am using Google Container Builder to build images and push them to gcr.io

How can trigger a pull/run on a CoreOS VM after the build is finished? (I can't use Google Container Engine)

If you are building the container in the Cloud Shell, and need to pull and run the image on your CoreOS VM, you could use the following command as a basis to achieve this. This presumes you are using a config file to instruct Container Builder to perform tasks based on your specifications, and that you are in the same directory as the Dockerfile (a similar method to that outlined here ):

gcloud container builds submit --config cloudbuild.yaml . && gcloud compute ssh INSTANCE_NAME -- 'docker run -d gcr.io/PROJECT-ID/IMAGE:TAG'

The above command utilizes Container Builder to build the image and push it to Container Registry. Once that command completes the build and push, it accesses the instance and executes a docker run command to automatically run the image that is now stored in Container Registry. The command automatically exits the remote instance once complete.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM