An open API service indexing awesome lists of open source software.

https://github.com/codeimpossible/docker-volume-example


https://github.com/codeimpossible/docker-volume-example

docker docker-patterns docker-volumes patterns

Last synced: 7 months ago
JSON representation

Awesome Lists containing this project

README

          

# docker volume example

this is a test repo to show an issue I ran into with volume sharing in the docker-orchestrating-docker pattern.

## Running the example

```
$ ./start.sh
```

Will tell docker to build and run `Prep.dockerfile`. This container creates a volume to store some the files within the repo:

- `vol_scripts` which contains all the *.sh files

## The issue
The prep container will build successfully, but the `docker run` command will fail with an error similar to ```cp: can't stat '/app/*.sh': No such file or directory```

This happens whenever a container attempts to access a volume that is in use inside another container. In this case it's the `/app` volume on the prep container that is causing the error, since `prep.sh` attempts to bind-mount that directory into a container in order to populate the other docker volumes with data.

## The workaround
So far the workaround has been to take any data that you need to share between containers that are run via the DOD pattern and store it in volumes _before_ you launch the container and mount them in using the `-v` or `--mount` options of `docker run`.