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 :

  • Artifactory allow anonymous access for docker pull
  • How to access the virtual repo in artifactory
  • How to encode an arbitrary command to a exec form in Dockerfile?
  • dumb-init No such file or directory
  • Docker. Does restart container means the same as restart process from CMD instruction?
  • boot2docker behind proxy - certificate signed by unknown authority
    • 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 ?

  • Issue with assigning static IP to docker container using Terraform
  • no route to host between 2 docker containers in same host
  • Golang connect to docker connect to my sql docker getsockopt: connection refused
  • How to enable code running in a docker container access files on the host on which the container is running?
  • Is it a docker best practice to use volume for the code?
  • Clone a secure git repo in Kubernetes pod
  • 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.