且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何从github仓库构建docker镜像

更新时间:2022-06-25 05:25:37

docker build uri#ref:dir是什么格式?


Git URL在其片段部分接受上下文配置,
用冒号分隔:。第一部分代表
Git将检出的引用,它可以是分支,标签或提交
SHA。第二部分表示存储库
中的一个子目录,该子目录将用作构建上下文。

Git URLs accept context configuration in their fragment section, separated by a colon :. The first part represents the reference that Git will check out, this can be either a branch, a tag, or a commit SHA. The second part represents a subdirectory inside the repository that will be used as a build context.

例如,运行此命令以使用一个名为docker的目录,
分支容器:

For example, run this command to use a directory called docker in the branch container:



docker build https://github.com/docker/rootfs.git#container:docker

https://docs.docker.com/engine/reference/commandline/build/