question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

FileNotFound in docker environment

See original GitHub issue

Hi,

I’ve some trouble with the de.flapdoodle.embed.mongo library in my Unit Tests. My Unit Tests are written in Java 8 using the Spring-Boot Framework in version 2.0.9.RELEASE. The embbeded mongodb is the suggested version from spring (2.0.3).

The unit tests runs on a jenkins using docker. The exception I have got is

Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'embeddedMongoServer' defined in class path resource [org/springframework/boot/autoconfigure/mongo/embedded/EmbeddedMongoAutoConfiguration.class]: Invocation of init method failed; nested exception is java.io.IOException: Cannot run program "/tmp/extract-1aabfc01-694e-475b-b260-79d3c107a6d3extractmongod": error=2, No such file or directory
Caused by: java.io.IOException: Cannot run program "/tmp/extract-1aabfc01-694e-475b-b260-79d3c107a6d3extractmongod": error=2, No such file or directory
Caused by: java.io.IOException: error=2, No such file or directory

To use the mebedded mongodb, I have annotated my class this @DataMongoTest.

I already can say, that this file in the tmp directory is existing and it seams to be not empty. On other systems works the embedded db fine, such as on a macOS system or a debian linux server without docker. This error I’ve got seams to me as a problem using the embedded mongodb inside a docker container. I’ll run my unit tests using maven.

Do anyone have some suggestions where the error is? Thanks for help

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:16 (9 by maintainers)

github_iconTop GitHub Comments

6reactions
Tobisaninfocommented, Apr 20, 2019

I can finally report that my unit tests running fine 😀

For documentation reasons, here are my steps I have done to achieve that.

  1. First I defined some env variables in the docker compose file:
    environment:
      - "LANG=en_US.UTF-8"
      - "LANGUAGE=en_US.UTF-8"
  1. Second in the alpine docker container I run these following commands:
apk --no-cache add ca-certificates
wget -q -O /etc/apk/keys/sgerrand.rsa.pub https://alpine-pkgs.sgerrand.com/sgerrand.rsa.pub

wget https://github.com/sgerrand/alpine-pkg-glibc/releases/download/2.29-r0/glibc-2.29-r0.apk
wget https://github.com/sgerrand/alpine-pkg-glibc/releases/download/2.29-r0/glibc-bin-2.29-r0.apk

apk add glibc-2.29-r0.apk glibc-bin-2.29-r0.apk

wget https://github.com/sgerrand/alpine-pkg-glibc/releases/download/2.29-r0/glibc-i18n-2.29-r0.apk
apk add glibc-bin-2.29-r0.apk glibc-i18n-2.29-r0.apk
/usr/glibc-compat/bin/localedef -i en_US -f UTF-8 en_US.UTF-8
  1. Update the versions in my project, setting these to the following:
de.flapdoodle.embed.mongo=2.2.0 (maven)
spring.mongodb.embedded.version=3.2.22 (application.properties)

Thank you for the great help over easter.

0reactions
Loki-Afrocommented, Apr 20, 2019

thanks for documenting, enjoy your holidays too  🍺

Read more comments on GitHub >

github_iconTop Results From Across the Web

Docker Run results in a FileNotFound error even though the ...
Does anybody know why the project claims the file doesn't exist, when in fact it does, and the parameter is passed correctly? I...
Read more >
Debugging a weird 'file not found' error - Julia Evans
I had a Go program called serve.go, and I was trying to bundle it into a Docker container with this Dockerfile: FROM golang:1.17...
Read more >
FileNotFoundException while running docker image-docker
See the basic problem in your dockerfile is. You are setting WORKDIR then while COPY you said COPY in /home/app so if you...
Read more >
How to fix docker error executable file not found in $PATH?
Since it is a very generic error thrown by the docker container, ... a shell then all of your environment variables will not...
Read more >
"wsl": executable file not found in %PATH%, So Docker ...
But … I don't know what that means. Is the docker not installed because of the wrong PATH environment variable? Or is the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found