0

I have a jar file, which I need to create a docker image. My jar file is dependent on an application called ImageMagick. Basically, ImageMagick will be installed and the path to image magick will be added as an environmental variable. I am new to Docker, and based on my understanding, I believe, a container can access only resource within the container.

So I created a docker file, as such

FROM openjdk:8
ADD target/eureka-server-1.0.0-RELEASE.jar eureka-server- 
1.0.0-RELEASE.jar
EXPOSE 9991
RUN ["yum","install","ImageMagick"]
RUN ["export","imagemagix_home", "whereis ImageMagick"](Here is what am 
struggling that, i need to set env variable by taking the installation 
directory of imagemagick. Currently iam getting null)
ENTRYPOINT ["java","-jar","eureka-server-1.0.0-RELEASE.jar"]

Please let me know, whether the solution am trying is proper, or is there any better solution for my problem.

Update,

As am installing an application and setting env variable at the build time, passing an argument in -e runtime is no use.I have updated my docker file as below,

FROM openjdk:8
ADD target/eureka-server-1.0.0-RELEASE.jar eureka-server- 
1.0.0-RELEASE.jar
EXPOSE 9991
RUN ["yum","install","ImageMagick"]
ENV imagemagix_home = $(whereis ImageMagick)
RUN ["wget","https://johnvansickle.com/ffmpeg/builds/ffmpeg-git-64bit- 
static.tar.xz"]
RUN ["tar","xvf","ffmpeg-git-*.tar.xz"]
RUN ["cd","./ffmpeg-git-*"]
RUN ["cp","ff*","qt-faststart","/usr/local/bin/"]
ENV ffmpeg_home = $(whereis ffmpeg)
ENTRYPOINT ["java","-jar","eureka-server-1.0.0-RELEASE.jar"]

And while am building, iam getting an error that,

OCI runtime create failed: conatiner_linux.go: starting container process caused "exec": "\yum": executable file not found in $PATH: unknow.

Update

yum is not available in my base image package, so I changed yum as apt-get as below,

 RUN apt-get install build-essential checkinstall && apt-get build-dep 
 imagemagick -y

Now am getting package not found build-essential, check install. returned a non-zero code 100 Kindly let me know whats going wrong

1 Answers1

2

It seems build-essential or checkinstall is not available. Try installing them in separate commands. Or searching for them. Maybe you need to do apt-et update to refresh the repository cache before installing them.

babaorum
  • 316
  • 1
  • 2