php composer inside container lost vendor directory

I have the following Dockerfile

FROM        bitgandtter/sf:php7

# basic env fix
ENV         TERM xterm

# install packages
ADD         .   /var/www

# update dependencies
RUN         cd Helpers && SYMFONY_ENV=prod composer update -o --no-dev

ENV         SYMFONY_ENV prod

After build the image the Helpers directory does not contain the vendor directory.

  • Invalid US-ASCII character using SASS
  • Pros and cons of multi-threading vs containers for a consumer program [closed]
  • Docker container shows running even after exit command
  • Cannot create docker container in OpenStack
  • Force Docker Swarm container distribution
  • How do I send app logs to Elasticsearch from within a Dockerized Node app?
  • I really dont know why is that since the previous compsoer update just execute successfully and the image was created just fine.

    Any help please

    NOTE: the image bitgandtter/sf:php7 use a VOLUME declaration on /var/www

  • Does docker on Windows SBS 2011 write to mounted volume immediately?
  • docker on windows not working
  • Issues accessing Sinatra app in Docker container
  • Run a docker command from Groovy script
  • Docker doesn't resolve hostname
  • GitLab Runner reporting failed docker image build stage as passed
  • One Solution collect form web for “php composer inside container lost vendor directory”

    In fact i discover that the VOLUME declaration on the base image was the main issue.

    As explained in the official doc after define a VOLUME on a dockerfile if any file changes happens inside that volume will be lost.

    So the solution is to not declare VOLUMES on base images.

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