<p>I'm trying to build a docker image using golang, I've found this (<a href="https://godoc.org/github.com/moby/moby/client#Client.ImageBuild" rel="nofollow">https://godoc.org/github.com/moby/moby/client#Client.ImageBuild</a>) which is fantastic. However I'm a bit confused on what the <code>buildContext</code> is supposed to be.
I found this post on github: <a href="https://github.com/moby/moby/issues/27186" rel="nofollow">https://github.com/moby/moby/issues/27186</a>
which uses a tar file. Is that tar the Dockerfile + all the files you want to link to the container? </p>
<p>Has anyone done this before? Or know of some better documentation? Google-fu isn't working because all the results are about building docker containers for go apps :/</p>
<hr/>**评论:**<br/><br/>endophage: <pre><p>Hey, docker engineer here. Can't say I've touched this exact API but educated guess is it's a tar file of the directory you want to use when you "ADD", COPY" etc in the Dockerfile. </p>
<p>For example, if I have the line "ADD config.json /var/lib/foo/config.json" the first path (the "from" location) is looked up in what we generally refer to as the build context. </p></pre>Idontlikecold: <pre><p>Ah ok thanks! </p></pre>bkeroack: <pre><p>Yes, it's an uncompressed tar stream of the filesystem contents at the root of the Docker build (in other words, everything that would be added in a <code>COPY .</code> Dockerfile command)</p>
<p><a href="https://github.com/dollarshaveclub/furan/blob/master/lib/builder/builder.go#L384" rel="nofollow">https://github.com/dollarshaveclub/furan/blob/master/lib/builder/builder.go#L384</a></p></pre>
这是一个分享于 的资源,其中的信息可能已经有所发展或是发生改变。
入群交流(和以上内容无关):加入Go大咖交流群,或添加微信:liuxiaoyan-s 备注:入群;或加QQ群:692541889
0 回复
- 请尽量让自己的回复能够对别人有帮助
- 支持 Markdown 格式, **粗体**、~~删除线~~、
`单行代码`
- 支持 @ 本站用户;支持表情(输入 : 提示),见 Emoji cheat sheet
- 图片支持拖拽、截图粘贴等方式上传