docker-compose


When are docker-compose on-the-fly volumes reused vs. recreated?


I have a docker-compose.yml like this:
version: '2'
services:
app:
build: .
volumes:
- /usr/src/app
If I do docker-compose up, then any changes I make to the /usr/src/app are persisted across runs. I can control+C and then docker-compose up, and the contents are still there.
But if I do docker-compose run app ls -la /usr/src/app, then the path is always empty.
My goal is that I'd like to have that volume 1) automatically created on the fly for me, 2) specific to this docker-compose project (since I'll have many others), and 3) persist across docker-compose up/run/etc.
I think one way around this is to use named volumes, which will automatically pull the name of my docker-compose project.
But with on-the-fly containers, is this the expected behavior? They persist automatically for docker-compose up, and are recreated from scratch for each docker-compose run?
Also, is there any documentation that makes clear the lifetime of on-the-fly containers?
Thanks!

Related Links

Docker Compose port issue. Cannot launch docker project on localhost
Name an image built from running a docker-compose file
Race conditions after changing names in docker-compose.yml
Docker compose - image not found
How to work out the hostname that compose gives containers?
docker-compose restart container if service is dead
Swarm scheduling not working as expected using filters in compose file
issues in buiding Slate with Docker
Invalid type error in Docker Compose
Django cookiecutter with Docker add pip package
Docker Compose + Swarm + Machine Networking issue
docker-compose build image parameters --force-rm --pull
linking 2 containers through docker compose
Files created by manage.py commands not chown'd from root user
Is it possible to create an intermediate image within docker-compose?
docker-compose service listen on specified interface

Categories

HOME
autohotkey
youtube-api
botframework
salesforce
qemu
reference
stdout
cryengine
opengl-es
symfony-sonata
localhost
powerquery
ejb-3.0
runtime
facebook-sharer
element
github-flavored-markdown
console-application
amazon-data-pipeline
loader
conditional-formatting
datasource
jq
rndis
google-drive-android-api
android-wear-2.0
nsopenpanel
adobe-captivate
r-factor
undo
tikz
urhosharp
wercker
imdb
qt-designer
machine-code
asp.net-webhooks
azure-vm-scale-set
perf
device-driver
realloc
framebuffer
byobu
directadmin
paperclip
binary-decision-diagram
azure-data-catalog
spring-data-commons
openxava
enet
playframework-1.x
selection-sort
overhead
spring-cloud-aws
class-design
git-cherry-pick
kik
sbt-proguard
python-rq
wonderware
android-contentresolver
android-facebook
sdkman
webservices-client
self-join
musicbrainz
tess4j
log-analysis
tinymce-plugins
sicstus-prolog
fiware-health
xcode5
uiblureffect
sync
azure-worker-roles
time-frequency
twitter-finagle
ant-contrib
winrun4j
nativequery
wpd
gmail-imap
cryptarithmetic-puzzle
freeimage
derived-class
ios6-maps
filedialog
erlide
socketasynceventargs
pinchzoom
jqzoom
mscorlib
wdm
youtube.net-api
lightopenid
text-manipulation
qprocess
weak-typing

Resources

Mobile Apps Dev
Database Users
javascript
java
csharp
php
android
MS Developer
developer works
python
ios
c
html
jquery
RDBMS discuss
Cloud Virtualization
Database Dev&Adm
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App