Overriding VOLUME directive in a Dockerfile

I’m building my own image on top of docker.io/mongo:3.2, but I have a problem with persisting some changes (creating new users) in the build process.

I’m aware that this happens because the users are created in the /data/db, which is defined as VOLUME in the original MongoDB Dockerfile.

  • Docker volumes qustion
  • Docker Network Nginx Resolver
  • Docker Network Namespace
  • Run DDL-script generated by Entity Framework does not create tables in Docker container
  • Docker - install php-memcached extenstion not working?
  • Unable to connect to containers of a swarm in docker-in-docker
  • My question is if there is a way I can add users during the build process and make those changes persist the build process.

    Alternatively, if that isn’t possible, how can I add the DB users during the build process of my image?

  • PDAL: filters.outlier: Unexpected argument 'extract'
  • How to configure Docker in windows to listen to tcp?
  • Docker does not release port inside container when tomcat service is stopped
  • how to automatically monitor and restart the docker container when it crashes down?
  • Docker official registry url
  • Unable to run build for gitlab-ci using docker on windows server
  • Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.