0

I use boot2docker and want to build a simple docker image with the Dockerfile:

# Pull base image.
FROM elasticsearch

# Install Marvel plugin

RUN \
    && export ES_HOME=/usr/share/elasticsearch  \
    && cd $ES_HOME  \
    && bin/plugin  -u  file:///c/Users/buliov1/dev/elastic/plugins/marvel-latest.zip -i elasticsearch/marvel/latest

The path /c/Users/buliov1/dev/elastic/plugins/marvel-latest.zip is present and accessible on the machine where I build the dockerfile . The problem is that inside the build i get Failed: FileNotFoundException[/c/Users/buliov1/dev/elastic/plugins/marvel-latest.zip (No such file or directory)].

I searched through the documentation and the only solution I see is to use ADD/COPY and copy first the file inside the image and then run the command that uses the file. I don't know how exactly docker build works but , is there a way to build it without copying the file first?

Ovidiu Buligan
  • 2,784
  • 1
  • 28
  • 37
  • It seems to me that the Windows syntax is not allowed in a Dockerfile, as Docker runs on Linux. On Windows, boot2docker runs a Linux minimal VM inside Virtualbox. From that Linux VM inside Virtualbox, I doubt you can do a `dir file:///c/Users/buliov1/dev/elastic/plugins/marvel-latest.zip`or such. On a sidenote, I would use `ENV ES_HOME=/usr/share/elasticsearch` rather than your export – user2915097 Mar 18 '15 at 14:30
  • the same problem with ENV ES_HOME is that it cannot be expanded at build time. BTW /c/Users/buliov1/ path is a share inside boot2docker-vm shared with the windows host by default created when boot2docker is initialized it is very useful for mounting it forward to containers for quick prototyping – Ovidiu Buligan Mar 20 '15 at 18:54

1 Answers1

2

A docker build process is running inside Docker containers and has no access to the host filesystem. The only way to get files into the build environment is through the use of the ADD or COPY mechanism (or by fetching them over the network using, e.g., curl or wget or something).

larsks
  • 277,717
  • 41
  • 399
  • 399
  • After all I used a COPY to /tmp/ and run it from there. Normally I wouldn't need copy since bin/plugin can install from a a preconfigured remote repository (like apt-get) but I couldn't configure the proxy inside build process for && bin/plugin command for this image. – Ovidiu Buligan Mar 18 '15 at 14:50