bucrogers / Dockerfiles-for-windows

Dockerfiles for SQL Server, ASP.NET 4.6 / IIS App, Docker Swarm, PostgreSQL, Python REST service et al.
MIT License
136 stars 56 forks source link

Failed to pull postgresql-windows image #9

Open shahrilrizal opened 7 years ago

shahrilrizal commented 7 years ago

hi all, i get this error after pulling postgresql-windows image to windows server 2016.

failed to register layer: re-exec error: exit status 1: output: ProcessBaseLayer C:\ProgramData\docker\windowsfilter\7d5e3af752f5765eb9407c1250824d2a2ba55d3ae1498c4f1907525762190ec f: Cannot create a file when that file already exists.

Can anyone help?

StefanScherer commented 7 years ago

The image can't be pulled with RTM versions of Windows. At that time TP5 was out and a lot thkngs have changed since then. I haven't found other Windows images for PostgreSQL. You have to build an own image, the Dockerfile needs at least an update in the FROM instruction.

shahrilrizal commented 7 years ago

do you know any tutorial to build that image?

From: Stefan Scherer Sent: Thursday, May 18, 2017 3:18 AM To: brogersyh/Dockerfiles-for-windows Cc: shahrilrizal ; Author Subject: Re: [brogersyh/Dockerfiles-for-windows] Failed to pull postgresql-windows image (#9)

The image can't be pulled with RTM versions of Windows. At that time TP5 was out and a lot thkngs have changed since then. I haven't found other Windows images for PostgreSQL. You have to build an own image, the Dockerfile needs at least an update in the FROM instruction.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

StefanScherer commented 7 years ago

I did a short test and updated the Dockerfile to build it with current Win10/Win2016 environments

FROM microsoft/windowsservercore

SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"]

ENV PGDATA c:\\sql
ENV PGPORT 5432
#not using PGUSER here due to need to run createuser downstream to create role
ENV PGUSERVAR postgres
ENV PGDOWNLOADVER postgresql-9.5.2-1-windows-x64-binaries.zip

# download and extract binaries
RUN wget http://get.enterprisedb.com/postgresql/$env:PGDOWNLOADVER -outfile $env:PGDOWNLOADVER ; \
    expand-archive $env:PGDOWNLOADVER -force -destinationpath /postgresql ; \
    rm $env:PGDOWNLOADVER

#install VC 2013 runtime required by postgresql
#use chocolatey pkg mgr to facilitate command-line installations
RUN iex ((new-object net.webclient).DownloadString('https://chocolatey.org/install.ps1'))
RUN choco install vcredist2013 -y

# copy dependent script(s)
COPY . /install

WORKDIR /postgresql/pgsql/bin

# init postgresql db cluster, config and create and start service
RUN powershell /install/init-config-start-service $env:PGDATA $env:PGUSERVAR

# start postgreSQL using the designated data dir
CMD powershell /install/start detached $env:PGDATA $env:PGUSERVAR

This still does not use all the features available on Windows (like EXPOSE or VOLUME), but it may help you build it and it will start a DB server. Would be good if someone sends a pull request to the official postgres Docker image to add a Windows image for that, too :-)