Do Dockerfile WORKDIR, ENTRYPOINT, VOLUME … apply to child images?

I want to create two Docker images, one being the child of the other. But I don’t know if the properties (such as WORKDIR, ENTRYPOINT , VOLUME, …) I specified in the parent will apply to child.

For example if I have these two images with these two Dockerfiles :

  • Running bvlc-caffe docker image as non-root user results in unexpected NVCC flags
  • 'Graph' object has no attribute 'SerializeToString' on Windows Docker
  • Docker-compose build blocked after saying “Building <service>”
  • Docker-Compose mount on Windows Server 2016 TP4
  • Docker: how to see output/error of CMD [ “python”, “./” ]
  • Postfix in Docker container can't resolve MX unless it gets restarted once
    • myrepo/webapp-build

      FROM ruby:2.2.3
      RUN mkdir -p /app
      WORKDIR /app
      COPY Gemfile Gemfile.lock ./
      RUN gem install bundler && bundle install
      VOLUME /app
      ENTRYPOINT ["bundle", "exec"]
    • myrepo/webapp

      FROM myrepo/webapp-build
      COPY . ./
      EXPOSE 3000
      CMD ["rails", "server", "-b", ""]

    Will the second image copy the files into /app ? Will my entrypoint in the second image be bundle exec ?

  • How to connect spring application on docker to a cluster of activemq on docker
  • Enable Thrift in Cassandra Docker
  • docker service replicas remain 0/1
  • Cannot start a docker container
  • My 'docker run' command uses 2 cpu cores by default. How to increase it?
  • Cannot connect to the Docker daemon (port 2375)
  • One Solution collect form web for “Do Dockerfile WORKDIR, ENTRYPOINT, VOLUME … apply to child images?”

    Those properties do propagate from one base image to another using said base image (with a FROM directive).

    But regarding WORKDIR, it is better to repeat it in order to document what ‘.’ means in a COPY . xxx

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