Question: I have built a tomcat docker image from [here](https://github.com/docker-library/tomcat/blob/af4b04d13a880a81a73dc2936afdf44147144418/8.0/jre8/Dockerfile).

I want to map the tomcat folder to the host machine, so I can simply access it, mainly I will need `webapps` and `logs` folder. `webapps` folder is simply required to deploy a war file and `logs` folder is for log tracing from host machine.

So I make it simpler, by mapping the whole tomcat folder like below:

```
docker run -ti --rm -p 8888:8080 -v C:/data:/usr/local/tomcat/ <image>

```

But I got this error:

> 
> docker: Error response from daemon: OCI runtime create failed:
>  container\_linux.go:296: starting container process caused "exec:
>  \"catalina.sh\": executable file not found in $PATH": unknown.
> 
> 
> 

Any suggestions?

Answer: 
In the tomcat docker file you linked, line 3:

`ENV CATALINA_HOME /usr/local/tomcat`

Which means, when you mount your C:\data to /usr/local/tomcat/, you're removing pretty much all of the files tomcat needs in order to function, including the catalina.sh being complained about. Docker bind mounted volumes *are not additive*, so when you mount C:\data to /usr/local/tomcat/, you are totally replacing what exists in /usr/local/tomcat with what is in C:\data.

To do what you want here, consider changing the default locations where tomcat will look for webapps and logging. [Here's a helpful SO answer to get you going in the right direction](https://stackoverflow.com/questions/10076754/how-does-tomcat-locate-the-webapps-directory).

Then you'd do something like this:

`docker run -ti --rm -p 8888:8080 -v C:/data/webapps:/webapps -v C:/data/logs:/logs <image>`
As specified in the Dockerfile, the container is started using the command `CMD ["catalina.sh", "run"]` which is found under `/usr/local/tomcat`.

When you mount an existing directory from the host onto `/usr/local/tomcat`, the content inside the container on `/usr/local/tomcat` will be the same as the host dir. This is causing the startup script `catalina.sh` to not be found.

To solve this problem, you can specify a non existing directory on the host, which will be created.

```
docker run --rm -p 8888:8080 -v C:/data/tomcat:/usr/local/tomcat/ <image>

```

where `C:/data/tomcat` doesn't exist or use a named volume with a specific mount point as such:

```
docker volume create --name tomcat-data -o type=none -o device=C:/data/tomcat -o o=bind

docker run -ti --rm -p 8888:8080 -v tomcat-data:/usr/local/tomcat/ <image>

```