-
-
Notifications
You must be signed in to change notification settings - Fork 187
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
When running inside docker, mongoServer.getConnectionString() hangs #254
Comments
please give information on what your system is (with version if linux distro) and your used docker image PS: if your image is based on alpine, then sorry, mongodb dosnt have a build for alpine PPS: i edited your issue's code to be better & faster to understand |
I'm running on mac Mojave |
Information: @dotanrs could you provide the output of |
|
This comment has been minimized.
This comment has been minimized.
Tried now with the
Same result:
|
@dotanrs because it is exactly the same, i need to ask: are you sure it is in the docker container? |
I'm running in a container, I tried both locally and in Jenkins However I did use a docker volume, and I guess that's why it happened. re-installing Thanks for the help! |
I have a similar problem and I believe I find the root cause. My set up consist of a host with ubuntu, and a docker development environment with centos. I use the same set of source files by mounting it by the docker. I run my IDE in ubuntu, with unit-test on save enabled. And occasionally I will do a full build inside the docker. However, mongodb-memory-server will only work in one of these two environment at one moment. This is because the mongod downloaded will only work on one of these distro. If it was downloaded in ubuntu, the tests won't work in centos. I suggest that appending |
no it wouldnt, because mongodb-memory-server checks if the file already exists when yes, dont download it again, and when you not use so, either install and use the |
It will happens for my use case, as I am working on the same set of source files from two distro at the same time. This is very important for me, as my code interacts with other native codes that is distro dependent, so I have to run test in two distro after each code changes. Yes, It will be solved by clearing my node_modules/.cache every time, by that will also means that I will need to redownload mongod hundreds of time a day! |
@firstnoises like i said, use the |
That make sense, thanks |
@firstnoises made a proposal at #256, will follow up with a PR when i have the time |
For those who are using MMS in docker I recommend to build a new image with MongoDB binaries and use env variable |
@alexbjorlig when you know how to make an docker image: (https://docs.docker.com/engine/reference/builder/)
example:
|
@hasezoey thanks for the help, but I am unsure how/where to do this in a github actions? Currently my github-action config look like this:
So my idea right now would be to create a new docker image, from the above image, but including the MMS binaries. To be honest I would prefer not having to maintain a docker image (or configuring docker at all 😁) - so if you have any other ideas for solving the issue please let me know 😊 Update I added this docker file,
But I still get the this error when using the docker image in a Github action:
|
@alexbjorlig if you need the global version you need to install
i know what you mean, but it is quite easy with docker's auto-build (on github pushes / on FROM changes) |
@hasezoey thanks for helping out. With this Docker file:
I still get this error:
|
@alexbjorlig you need to point |
I published the container here. When I connect and look for the .cache, this is all I get (no .cache directory) 🤷🏽♂️ Where should I look for the binaries then? |
@alexbjorlig just build it myself, the issue is easily identified - the system for your build is "debian10", which dosnt have an "4.0.3" build available, the earliest version i could find is "4.2.1" |
@hasezoey thanks for trying it out - I'm trying to figure all this out 🤓What do you mean by "4.0.3" build? Build of what - is this something I can "fix" ? |
@alexbjorlig the version "4.0.3" & "4.2.1" as in "version of mongodb binary" - you can fix this by one of those:
update: you can set the global config file anywhere, but need to set the environment variable |
Ok, option 1 sounds like the best one. But I will have to read more about manually downloading the binary, I am unsure about how to do this. But thanks for trying to help me out, so nice of you 🙏🏽 |
some hints: |
Hi @hasezoey - I think I'm getting close now 😅 My only problem seem to be the
It fails with: But if I build the docker image without the ADD command, and run the container to inspect the files, the |
@alexbjorlig simple, you use |
Hmm ok - so does that mean I don't need this command at all `ADD mongodb/bin/mongod mongod? |
@alexbjorlig yes, you dont need an ADD if you execute an RUN download, i assumed to download it on the host machine and add it later
|
@hasezoey amazing - it worked 🥳 😂 🎉! The final docker image is this:
And when using this image inside a Github action, I get this good looking log statement 😎 Thanks for helping me out fixing this issue. If there is somehow I can return the favor, please let me know 🙃 |
Just upgraded to cypress/browsers:node12.16.1-chrome80-ff73 and this has broken my test builds using Codebuild. |
closing because original issue was solved
which was caused by mounting the host's node_modules |
The solution was taken from here: typegoose/mongodb-memory-server#254 (comment)
The solution was taken from here: typegoose/mongodb-memory-server#254 (comment)
The solution was taken from here: typegoose/mongodb-memory-server#254 (comment)
The solution was taken from here: typegoose/mongodb-memory-server#254 (comment)
I started a docker container that runs node, and executed the following commands:
Done
is never printed, whereas outside docker this works fineThe text was updated successfully, but these errors were encountered: