本地写好一份 Dockerfile,然后上传到 Github。DockerHub 会根据上传的 Dockerfile 自动构建镜像
我写好一份 Dockerfile,然后上传到 Github 的仓库,目录结构是这样
1 | ├─ README.md |
然后在 DockerHub 新建一个 Repository,取名为 ikutarian/aliyun_ubuntu,并创建构建脚本
根据 Github 仓库的目录结构,Dockerfile 在 aliyun_ubuntu 文件夹里, 所以 Build Context 要写成 /aliyun_ubuntu/。至于 Dockerfile location 的值,按照文档的说法
Path from the repository root to the files to build. The Dockerfile location is relative to this path
也就是说 Dockerfile location 是相对 Build Context 路径来查找的。如果你的 Dockerfile 文件名没有改的话,默认就写 Dockerfile
填写完毕之后就开始构建
可以查看构建的 Log,比如我的
1 | Building in Docker Cloud's infrastructure... |
可以看到构建已经成功了