Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docker for Windows image #3

Open
garrensmith opened this issue Apr 25, 2017 · 8 comments
Open

Docker for Windows image #3

garrensmith opened this issue Apr 25, 2017 · 8 comments

Comments

@garrensmith
Copy link
Member

From docker-couchdb: klaemo/docker-couchdb#107

Other official repositories such as mongo and redis are now offering native Windows container images.

What are the plans for offering a CouchDB Windows image?

I have tried to build one myself. When I make the data directory a VOLUME Erlang quits shortly after the container starts. So there appears to be some kind of compatibility problem with CouchDB and Windows containers.

Let me know what information I could collect to diagnose why it doesn't work with native Windows docker.

@garrensmith
Copy link
Member Author

Comments from original PR by @drnybble:
FYI I have logged moby/moby#31524

@garrensmith
Copy link
Member Author

by @apihlaja:
As far as I know, the core issue of Alpine build applies to Windows too (ie. unmaintained mozjs).

Does your mounts work generally? Ie. is this issue narrowed down to CouchDB and/or Erlang? Docker For Windows FAQ suggest it's not as straightforward as it's with Linux host:

Q: Can I share local drives and filesystem with my Docker Machine VMs?
A: No, ....

@garrensmith
Copy link
Member Author

by @drnybble:

As discussed in moby/moby#31524 the cause of failure with Couch 1.6 is a defect in the Erlang version it uses. I have created a Dockerfile for Couch 2.0.0.1 and it works (the problem area of the Erlang code is extensively reworked and no longer has this problem). I am attaching the Dockerfile here if it is useful.

Here it is...relies on you having downloaded the .msi already.
It seems that couchdb 2.0 requires a post-install step to configure the system for single node or clustering. I am still thinking of the best way to do that to avoids lots of errors in the logs about missing databases.

FROM microsoft/windowsservercore

# Switch the default shell used with RUN to PowerShell
SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop';"]

# REMARK: Temporary workaround for https://github.com/docker/docker/issues/31093
RUN set-itemproperty -path 'HKLM:\SYSTEM\CurrentControlSet\Services\Dnscache\Parameters' -Name ServerPriorityTimeLimit -Value 0 -Type DWord

COPY apache-couchdb-2.0.0.1.msi C:/

# Stop & remove the service that the .msi installs (there are no properties exposed by the .msi to prevent it in the first place)
# We need empty data and log directories to be able make those volumes under Windows but they have contents due to the service having run.
# I was unable to remove the .delete directory in the data directory, so renaming the directories was the easiest solution
# Also bind couchdb to other than localhost
RUN Start-Process 'C:\Windows\System32\msiexec.exe' -ArgumentList '/i C:\apache-couchdb-2.0.0.1.msi /qn' -wait ; \
    Remove-Item 'C:\apache-couchdb-2.0.0.1.msi' ; \
	C:\couchdb\bin\nssm.exe stop 'Apache CouchDB' > $null ; \
	C:\couchdb\bin\nssm.exe remove 'Apache CouchDB' confirm > $null ; \
	mv C:\couchdb\data C:\couchdb\_data ; \
	mv C:\couchdb\var\log C:\couchdb\var\_log ; \
	New-Item -Path C:\couchdb\data -Type directory > $null ; \
	New-Item -Path C:\couchdb\var\log -Type directory > $null ; \
    Copy-Item C:/CouchDB/etc/local.ini C:/CouchDB/etc/local.ini.orig ; \
    cat C:/CouchDB/etc/local.ini.orig | % { $_ -replace ';bind_address = 127.0.0.1', 'bind_address = 0.0.0.0' } | Out-File C:/CouchDB/etc/local.ini -encoding ASCII
	

WORKDIR C:/CouchDB/

VOLUME C:/couchdb/data
VOLUME C:/couchdb/var/log

EXPOSE 5984

CMD ./bin/couchdb.cmd

@thorsten
Copy link

I can confirm that the Dockerfile is working

@erichiller
Copy link

Working here as well. v2.3.1 Thanks much!

@wohali
Copy link
Member

wohali commented Aug 26, 2019

We may simply transition CouchDB on Windows (10) to use Docker under WSL2. We need some performance testing to see if this makes sense, however.

@SecDWizar
Copy link

We may simply transition CouchDB on Windows (10) to use Docker under WSL2. We need some performance testing to see if this makes sense, however.

This is not good, WSL2 is still far from production in Windows Server, also LCoW is far from production on Windows Server; We need proper windows support of the product and not running a Linux version of it on Windows.

@wohali
Copy link
Member

wohali commented Sep 9, 2020

Not planning to do this anytime soon.

That said, the Windows port of CouchDB has terrible performance as compared to literally any other platform. It is not intended for production use, and you will have a bad time if you try to scale CouchDB on Windows. We publish the binaries to make development and testing easier.

Improving the performance on Windows would require a concerted effort from Microsoft, working with Ericsson, to improve file-based access on Windows in Erlang, especially when it comes to file locking mechanisms and stdio. We asked about this over 10 years ago, and are still waiting...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants