Questions tagged [volumes]
322 questions
175
votes
4 answers
Copying files to a container with Docker Compose
I have a Dockerfile where I copy an existing directory (with content) to the container which works fine:
Dockerfile
FROM php:7.0-apache
COPY Frontend/ /var/www/html/aw3somevideo/
COPY Frontend/ /var/www/html/
RUN ls -al /var/www/html
RUN chown -R…

TheDoctor
- 2,362
- 4
- 22
- 39
156
votes
6 answers
docker mounting volumes on host
I have successfully been able to share folders between a docker container with volumes using
docker run -v /host/path:/container/path ...
But my question is what the difference between this and using the VOLUME command in the Dockerfile
VOLUME…

Jeff Storey
- 56,312
- 72
- 233
- 406
133
votes
4 answers
Remove a named volume with docker-compose?
If I have a docker-compose file like:
version: "3"
services:
postgres:
image: postgres:9.4
volumes:
- db-data:/var/lib/db
volumes:
db-data:
... then doing docker-compose up creates a named volume for db-data. Is there a way to…

Bosh
- 8,138
- 11
- 51
- 77
44
votes
2 answers
Docker creates files as root in mounted volume
I'm using Docker (1.3.1) to build RPMs inside a container:
docker run -v /home/matt/build:/build build-rpm /build/build-pkg.sh
This works fine (my user is in the docker group, so I don't need to sudo) and drops a completed .rpm file in the current…

Matt R
- 9,892
- 10
- 50
- 83
31
votes
4 answers
how can I create a data-container only using docker-compose.yml?
This question is coming from an issue on the Docker's repository:
https://github.com/docker/compose/issues/942
I can't figure it out how to create a data container (no process running) with docker compose.

ivan
- 550
- 2
- 5
- 12
30
votes
5 answers
Copy docker volumes
I want to update some container. For testing, I want to create a copy of the corresponding volume. Set up a new container for this new volume.
Is this as easy as doing cp -r volumeOld volumeNew?
Or do I have to pay attention to something?

Ma Sch
- 501
- 1
- 4
- 8
28
votes
2 answers
What happens when a volume links an existing populated host and container dir
I've searched the docs but nothing came up so time to test it. But for a quick future reference...
Is the host folder populated with the container folder contents?
Is it the opposite?
Are both folder contents merged? (In that case: What happens when…

NotGaeL
- 8,344
- 5
- 40
- 70
23
votes
3 answers
Device vs Partition vs File System vs Volume: how do these concepts relate to each other, accurately
How do these concepts relate to each other, from a Java developer standpoint?
My question: Could someone provide explanations or some links for simple and accurate / generally accepted definitions? Tks.
for reference, documents I found but are not…

mins
- 6,478
- 12
- 56
- 75
22
votes
2 answers
Docker: change folder where to store docker volumes
On my Ubuntu EC2 I host an application using docker containers. db data and upload data is being stored in volumes CaseBook-data-db and CaseBook-data-uploads which are being created with this commands:
docker volume create…

DimonVersace
- 325
- 1
- 2
- 7
21
votes
3 answers
Re-using existing volume with docker compose
I have setup two standalone docker containers, one runs a webserver another one runs a mysql for it.
Right now I was attempting to have it working with docker-compose. All is nice and it runs well, but I was wondering how could I re-use existing…

jonuxas
- 325
- 1
- 2
- 6
21
votes
5 answers
Docker - cannot mount volume over existing file, file exists
I'm trying to build a data container for my application in Docker. I run this command to expose some volumes:
docker run --name svenv.nl-data -v /etc/environment -v /etc/ssl/certs -v /var/lib/mysql -d svenv/svenv.nl-data
The problem is that i get…

Sven van de Scheur
- 1,809
- 2
- 15
- 31
14
votes
1 answer
Docker Machine on Mac: Cannot see mounted Volumes on docker host/docker-machine? Where are volumes physically stored?
Am on a Macbook Pro laptop and running docker-machine (0.5.0) and docker-compose (1.5.0) to get my containers going.
This means I'm using docker-machine to create my virtualbox boot2docker driven HOST machines, which will run my docker daemon and…

skålfyfan
- 4,931
- 5
- 41
- 59
14
votes
1 answer
why does docker have docker volumes and volume containers
Why does docker have docker volumes and volume containers? What is the primary difference between them. I have read through the docker docs but couldn't really understand it well.

Manohar Negi
- 445
- 5
- 12
14
votes
4 answers
Detect when a volume is mounted on OS X
I have an OS X application that needs to respond to a volume being mounted or unmounted.
I've already solved this problem by retrieving the list of volumes periodically and checking for changes, but I'd like to know if there is a better way.

Brian
- 6,910
- 8
- 44
- 82
12
votes
1 answer
Mounting local volumes to remote docker container, Possible?
I'm pretty comfortable using Docker recently, typically to test websites to make sure they run properly on servers before I deploy them.
Typically, I mount my local directory to the locally running image like:
docker run -v…

user3888307
- 2,825
- 5
- 22
- 32