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 :
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"]
FROM myrepo/webapp-build COPY . ./ EXPOSE 3000 CMD ["rails", "server", "-b", "0.0.0.0"]
Will the second image copy the files into /app ? Will my entrypoint in the second image be bundle exec ?
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
WORKDIR, it is better to repeat it in order to document what ‘.’ means in a
COPY . xxx