Prevent volume creation on docker run

Dockerfile can contain VOLUME /path instruction. That means that when docker run is executed, docker creates automatically a volume and binds it to /path inside container.

I’d like to skip the automatic volume creation in some cases. Is that possible somehow?

  • How can I run a docker container on localhost over the default IP?
  • How to verify my docker-compose.yml?
  • What is the difference between the `COPY` and `ADD` commands in a Dockerfile?
  • Docker image creation exception: “This archives contains unclosed entries”
  • Nodejs child process-spawn in a container-docker
  • If I use EXPOSE $PORT in a Dockerfile, can I un-expose the port it when I use `docker run`?
  • Using Azure Container Service with volume mapping
  • Do I need a reverse proxy if I'm running a Node.js in a Docker container?
  • RedHat4/Docker on Centos 7. Can't reach internet from Docker Instance
  • Dockerfile - how to run script?
  • Docker IP changes makes locking down MySQL access tricky
  • Restrict Docker exposed port from only specific IP adresses
  • One Solution collect form web for “Prevent volume creation on docker run”

    Not once it’s be added to the Dockerfile. I’d personally avoid doing volumes inside of the Dockerfile since it ends up creating anonymous volumes as you’ve seen, but also because it breaks attempts to modify that directory in child images or even later steps inside of the same Dockerfile.

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