Creating first docker container: Can't find host system file on build

I’m trying to bundle my Jekyll blog as a docker container.

I found this Dockerfile which seems to suit my use case but wanted to be more hands on so I copied it directly into my repo:

  • Error while connecting WordPress Docker Container with MySQL
  • Variable substitution in docker-compose.yml file when running docker-compose with sudo
  • Sending Docker container logs to ELK Stack by configuring the logging drivers - Easy Method
  • Pushing a docker image into Artifactory via the publishing mechanism in gradle
  • Docker Run and variable substitution
  • How to set up executor IPs inside Docker containers?
  • FROM ruby:latest
    MAINTAINER Peter Etelej <>
    RUN apt-get -qq update && \
      apt-get -qq install nodejs -y && \
      gem install -q bundler
    RUN mkdir -p /etc/jekyll && \
      printf 'source ""\ngem "github-pages"\ngem "execjs"\ngem "rouge"' > /etc/jekyll/Gemfile && \
      printf "\nBuilding required Ruby gems. Please wait..." && \
      bundle install --gemfile /etc/jekyll/Gemfile --clean --quiet
    RUN apt-get clean && \
      rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
    ENV BUNDLE_GEMFILE /etc/jekyll/Gemfile
    EXPOSE 4000
    ENTRYPOINT ["bundle", "exec"]
    CMD ["jekyll", "serve","--host="]

    When I run it I get an error

    jekyll 3.4.3 | Error: No such file or directory @ rb_sysopen - /etc/modules-load.d/modules.conf

    The host system has this file but my assumption was that the container didn’t have access to it so I tried to add it into the Dockerfile

    ADD /etc/modules-load.d/modules.conf /etc/modules-load.d/modules.conf

    I then docker build and get the error

    lstat etc/modules-load.d/: no such file or directory

    I don’t understand why the container is looking for this file in the first place but I’m even more confused by the fact that I can’t add a file which is clearly there.

  • docker import data in mongodb successfull but nothing in database
  • docker compose run with command error
  • Jenkins,Sonar in single docker container
  • pipelines fail with custom docker image
  • Is Alpine Linux an implementation of a Unikernel?
  • boot2docker vm forgets changes when restarted
  • One Solution collect form web for “Creating first docker container: Can't find host system file on build”

    Docker builds run on the docker host, not necessarily the client where you run the command, and so all the files needed to run the build are sent in the build context to the host. That context is most often the current directory, or ., that you pass at the end of the docker build -t $image_name . command.

    Everything that you try to include in the image with a COPY or ADD is done in reference to that build context, not the filesystem on your client or host machine. So if you need a modules.conf, you’ll need to first copy that into your directory with the Dockerfile, and then COPY the file from there.

    As for why jekyll is looking for the file, I’m not familiar with jekyll, but it doesn’t look promising for something running inside of a container. The modules are kernel specific and containers are designed to be moved to different hosts with potentially different kernels.

    Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.