Docker: How do I pull a specific build-id?

我与影子孤独终老i 提交于 2019-12-03 10:57:17

The way I do it is to tag each build

docker build -t $NAMESPACE/$APP_NAME:$BUILD_SHA1 .
docker tag $NAMESPACE/$APP_NAME:$SHA1  $DOCKER_REGISTRY/$NAMESPACE/$APP_NAME:$SHA1
docker push $DOCKER_REGISTRY/$NAMESPACE/$APP_NAME:$SHA1

and then you pull the specific tag

docker pull $DOCKER_REGISTRY/$NAMESPACE/$APP_NAME:$SHA1

You can pull a specific image by digest by using the following syntax:

docker pull ubuntu@sha256:45b23dee08af5e43a7fea6c4cf9c25ccf269ee113168c19722f87876677c5cb2

If you need to find the hash, it is output when pushing/pulling the image. Some automated builds output it at the end. I tried looking for the hash with docker inspect but it didn't appear to be there, so you'll have to delete the image and pull it again to view the hash.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!