Does Docker override files?

I have created simple image based on mongo:latest. My Dockerfile is just

FROM mongo:3.3
MAINTAINER developer@encode.cz

Now when I run it by cmd docker run my-mongo mongod I get no /data/db error. But there is clearly RUN mkdir /data/db in mongo base image. Also pure mongo base image works as expected.

  • How to forward SSH into GitLab Docker container based on requested domain
  • Is there a Docker Swarm dashboard like Kubernetes' dashboard/ui? [closed]
  • Passing variables as arguments to docker container
  • Cant run net-core docker container though VS2015
  • docker remote api cannot bind a port to a host
  • Gcloud kubernetes/docker deploy works but stops responding after 10 minutes
  • Why is this folder not present in my custom image if it is in the base image?

  • Traefik with self-signed certificate
  • How to access a web application running on Mesos?
  • Cannot find the enviromental parameter
  • when pushing docker image to private docker registry, having trouble marking it 'public' via my script (but can do via web ui)
  • Tomcat doesn't start in docker container because it can't create log files
  • Nginx Docker's container : set default home page with a custom index.html
  • One Solution collect form web for “Does Docker override files?”

    I think you have problems in the way you are testing or I don’t understand well your question. I tested the official image:

    docker run -d --name mongo mongo:3.3 mongod
    docker exec -it mongo bash -c 'ls -la /data/db'
    
    total 192
    drwxr-xr-x 4 mongodb mongodb  4096 Oct 28 18:11 .
    drwxr-xr-x 4 root    root     4096 Oct 21 20:47 ..
    -rw-r--r-- 1 mongodb mongodb    46 Oct 28 17:56 WiredTiger
    -rw-r--r-- 1 mongodb mongodb    21 Oct 28 17:56 WiredTiger.lock
    -rw-r--r-- 1 mongodb mongodb   935 Oct 28 18:11 WiredTiger.turtle
    -rw-r--r-- 1 mongodb mongodb 40960 Oct 28 18:11 WiredTiger.wt
    -rw-r--r-- 1 mongodb mongodb  4096 Oct 28 17:56 WiredTigerLAS.wt
    -rw-r--r-- 1 mongodb mongodb 16384 Oct 28 17:57 _mdb_catalog.wt
    -rw-r--r-- 1 mongodb mongodb 16384 Oct 28 17:57 collection-0--3585910680230311914.wt
    -rw-r--r-- 1 mongodb mongodb 16384 Oct 28 17:57 collection-2--3585910680230311914.wt
    drwxr-xr-x 2 mongodb mongodb  4096 Oct 28 18:11 diagnostic.data
    -rw-r--r-- 1 mongodb mongodb 16384 Oct 28 17:57 index-1--3585910680230311914.wt
    -rw-r--r-- 1 mongodb mongodb 16384 Oct 28 17:57 index-3--3585910680230311914.wt
    -rw-r--r-- 1 mongodb mongodb 16384 Oct 28 17:57 index-4--3585910680230311914.wt
    drwxr-xr-x 2 mongodb mongodb  4096 Oct 28 17:56 journal
    -rw-r--r-- 1 mongodb mongodb     2 Oct 28 17:56 mongod.lock
    -rw-r--r-- 1 mongodb mongodb 16384 Oct 28 17:57 sizeStorer.wt
    -rw-r--r-- 1 mongodb mongodb    95 Oct 28 17:56 storage.bson
    

    Then I created a Dockerfile with your two lines and:

    docker build -t my-mongo .
    docker run -d --name my-mongo my-mongo mongod
    docker exec -it my-mongo bash -c 'ls -la /data/db'
    
    total 192
    drwxr-xr-x 4 mongodb mongodb  4096 Oct 28 18:12 .
    drwxr-xr-x 4 root    root     4096 Oct 21 20:47 ..
    -rw-r--r-- 1 mongodb mongodb    46 Oct 28 18:06 WiredTiger
    -rw-r--r-- 1 mongodb mongodb    21 Oct 28 18:06 WiredTiger.lock
    -rw-r--r-- 1 mongodb mongodb   932 Oct 28 18:12 WiredTiger.turtle
    -rw-r--r-- 1 mongodb mongodb 40960 Oct 28 18:12 WiredTiger.wt
    -rw-r--r-- 1 mongodb mongodb  4096 Oct 28 18:06 WiredTigerLAS.wt
    -rw-r--r-- 1 mongodb mongodb 16384 Oct 28 18:07 _mdb_catalog.wt
    -rw-r--r-- 1 mongodb mongodb 16384 Oct 28 18:07 collection-0-683121925029568227.wt
    -rw-r--r-- 1 mongodb mongodb 16384 Oct 28 18:07 collection-2-683121925029568227.wt
    drwxr-xr-x 2 mongodb mongodb  4096 Oct 28 18:13 diagnostic.data
    -rw-r--r-- 1 mongodb mongodb 16384 Oct 28 18:07 index-1-683121925029568227.wt
    -rw-r--r-- 1 mongodb mongodb 16384 Oct 28 18:07 index-3-683121925029568227.wt
    -rw-r--r-- 1 mongodb mongodb 16384 Oct 28 18:07 index-4-683121925029568227.wt
    drwxr-xr-x 2 mongodb mongodb  4096 Oct 28 18:06 journal
    -rw-r--r-- 1 mongodb mongodb     2 Oct 28 18:06 mongod.lock
    -rw-r--r-- 1 mongodb mongodb 16384 Oct 28 18:07 sizeStorer.wt
    -rw-r--r-- 1 mongodb mongodb    95 Oct 28 18:06 storage.bson
    

    Be aware, the /data/db directory is declared as a volume. If you are having problems withn that, restart the docker daemon and check your available disk space df -h

    Regards

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