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.

  • Gitlab CI hanging whilst using custom service image
  • ORA-31113 error when starting Apex 5 in Oracle 12c docker image
  • (psycopg2.OperationalError) could not connect to server: Connection refused Is the server
  • How to start a docker container (ubuntu image)
  • Deploying with docker push is slow because there are many images
  • What's the purpose of binding vip addr in every container of a service in docker 1.12?
  • 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?

  • A way to allow nginx load balancer to redirect all request
  • How to get my docker centos sshd passwordless server running?
  • How to free wasted space used by docker?
  • Minikube: how to ssh into the VM?
  • How to get Docker metrics using docker remote API
  • search on my Auth+TLS private docker registry
  • Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.