Merge pull request #384 from StefanScherer/fix-windows-registry-part-1

Use official golang, fix trailing space
This commit is contained in:
Mano Marks 2017-11-30 10:40:24 -08:00 коммит произвёл GitHub
Родитель 94ddff6a2c 8662b84b2b
Коммит 991d4bce4c
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
2 изменённых файлов: 7 добавлений и 13 удалений

Просмотреть файл

@ -1,13 +1,9 @@
# escape=`
# REMARK - when Go 1.8 is released we can use an official image for the base.
# There is an issue with Go 1.7 and Windows 2016 SYMLINKD directories which causes Docker volumes and host mounts to fail.
# This registry build uses a custom build of Go (@a2bd5c5) from the master branch to fix - https://github.com/golang/go/issues/15978
FROM sixeyed/golang:windowsservercore
FROM golang:windowsservercore
SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop';"]
CMD .\go get github.com/docker/distribution/cmd/registry ; `
CMD go get github.com/docker/distribution/cmd/registry ; `
cp \"$env:GOPATH\bin\registry.exe\" c:\out\ ; `
cp \"$env:GOPATH\src\github.com\docker\distribution\cmd\registry\config-example.yml\" c:\out\config.yml

Просмотреть файл

@ -22,18 +22,16 @@ The Dockerfile for the registry builder is in [Dockerfile.builder](Dockerfile.bu
```Dockerfile
# escape=`
FROM sixeyed/golang:windowsservercore
FROM golang:windowsservercore
SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop';"]
```
The base image is [sixeyed/golang](https://store.docker.com/community/images/sixeyed/golang) which is in the Docker Store, built from [this Dockerfile](https://github.com/sixeyed/dockers-windows/blob/master/golang/Dockerfile). It has the Go toolset installed, but rather than using a released version, it builds Go from the source on GitHub to get the latest features.
> Note. There is an [official Go image](https://store.docker.com/images/golang) on Docker Store, which has Windows Server Core and Nano Server variants. That uses the latest release of Go - 1.7 - which has [an issue](https://github.com/golang/go/issues/15978) that stops you using Docker volumes on Windows. It's fixed in the latest source code, which is why we use an image that builds from source, but when Go 1.8 is released we can switch to using the official image as the base for the builder.
The base image is the [official Go image](https://store.docker.com/images/golang) which is in the Docker Store.
There's a single `CMD` instruction to build the latest version of the registry and copy the built files to a known output location:
```Dockerfile
CMD .\go get github.com/docker/distribution/cmd/registry ; `
CMD go get github.com/docker/distribution/cmd/registry ; `
cp \"$env:GOPATH\bin\registry.exe\" c:\out\ ; `
cp \"$env:GOPATH\src\github.com\docker\distribution\cmd\registry\config-example.yml\" c:\out\config.yml
```
@ -44,7 +42,7 @@ When we run a container from the builder image, it will compile the latest regis
First we build the builder image - all the images in this lab use [microsoft/windowsservercore](https://store.docker.com/images/windowsservercore) or [microsoft/nanoserver](https://store.docker.com/images/nanoserver) as the base images, so you can only use a Windows host to build and run them. From a PowerShell session, navigate to the lab folder and build the builder:
```PowerShell
```PowerShell
docker build -t registry-builder -f Dockerfile.builder .
```
@ -99,4 +97,4 @@ The Docker image for the registry running on Nano Server is 310MB compressed and
## Next
- [Part 2 - Running a Registry Container](part-2.md)
- [Part 2 - Running a Registry Container](part-2.md)