---
title: Docker, Where's My Data?
description: In this blog post I'll show you a way that your data might go missing in your Docker containers when you use mounted volumes.
date: 2020-02-26
tags: Docker
source: https://brianchildress.co/blog/docker-wheres-my-data
---

# Docker, Where's My Data?

[Docker](https://www.docker.com/) is a fantastic tool, one of favorite in recent years, but it can have some unexpected behavior sometimes.

If you ever mount volumes to your Docker containers to provide access to shared files between your container and host, you might have run into this issue. When you mount a volume into your Docker container, Docker will override any existing files, data, etc. in that directory. 

Let's look at an example:

_Dockerfile_
```Dockerfile
...

COPY myapp/ /app

...
```

_Docker Run_
```sh
docker run -v $(pwd)/myotherapp:/app node 
```

Both our _Dockerfile_ and our _Docker run_ command are both trying to put files into the `/app` directory, one of them has to win. Docker will default to the docker run commands parameters, overriding anything defined elsewhere.
