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

Can .env file make environment variables?
docker copy container data to volume using compose
Docker-compose ps error
hyperledger-fabric getting-started failed to start cli container
how to make docker-compose pull latest images of certain services
network issue in one docker compose with keycloak and tomcat container
Docker compose, set local volume mapping with version 3
version control of docker-compose.yml
Limit resources in docker-compose v3
Docker compose: using relative service address in environment
Azure Container Service: Update Docker-Compose?
Docker compose: doesnt allow to use constraints if you have a env variable set
How to use visual studio docker function on Windows Home edition?
Passing arguments to docker compose file when using it for swarm
How to run ad hoc docker compose commands in Ansible?
Using custom hostnames for docker local development containers

Categories

HOME
logging
ssms
salesforce
c++builder
postsharp
boxplot
jquery-plugins
datetimepicker
opengl-es
snmp
docker-compose
hibernate-mapping
subprocess
ios-universal-links
velocity
android-notifications
background-image
web-worker
dompdf
greensock
brightway
openscad
internet-explorer-7
google-calendar-api3
turn.js
polybase
connectiq
smali
rvm
chartist.js
boosting
bytebuffer
folder
mobile-development
ios9
foxpro
slim-lang
epub
odp.net
device-driver
console.readline
iterm2
file-descriptor
firefox-developer-edition
text-extraction
cakephp-3.2
evaluation
ng-class
openidm
totalview
blackberry
bipartite
cardview
vertex-shader
android-tabs
racket-student-languages
disconnect
recurring
fadein
wonderware
angular-promise
jcomponent
windows-kernel
transbase
clearquest
esb-toolkit-2.1
genero
perfect-scrollbar
data-quality-services
conkeror
indices
nsq
sendy
codio
mdp
xml-validation
surfaceview
nokogiri
qgraphicsscene
backbone-views
removeall
pudb
nsautoreleasepool
generator-expression
ntdll
cryptarithmetic-puzzle
netzke
big-endian
blackberry-eclipse-plugin
php-gettext
nude.js
datasheet
facebook-winjs-sdk
openwrap
mdd
file-storage
onresize

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