Questions tagged [docker-volume]

A docker data volume is a specially-designated directory within one or more containers that bypasses the Union File System.

A docker data volume is a specially-designated directory within one or more containers that bypasses the Union File System. Data volumes provide several useful features for persistent or shared data:

  • Volumes are initialized when a container is created. If the container’s base image contains data at the specified mount point, that existing data is copied into the new volume upon volume initialization.
  • Data volumes can be shared and reused among containers.
  • Changes to a data volume are made directly.
  • Changes to a data volume will not be included when you update an image.
  • Data volumes persist even if the container itself is deleted.

Reference: https://docs.docker.com/engine/userguide/dockervolumes/

1402 questions
14
votes
2 answers

Docker mount volumes as root

Why does Docker mount volume as root, not as user which has run command docker run? Can this be changed by setting some parameters/arguments, etc.? MWE: $ ls -la drwxr-xr-x 2 ubuntu ubuntu 4096 Aug 22 18:09 shinylog $ docker run -v…
Taz
  • 5,755
  • 6
  • 26
  • 63
14
votes
1 answer

Relative Path with Docker-Compose Shared Volumes

It seems this question has already been asked by another poster, but there was no answer. I have more information on the matter, so I'm re-asking the same question - but with much additional material. I'm running Docker on Windows 10. I have…
Brent Arias
  • 29,277
  • 40
  • 133
  • 234
14
votes
1 answer

How to sync code between container and host using docker-compose?

Until now, I have used a local LAMP stack to develop my web projects and deploy them manually to the server. For the next project I want to use docker and docker-compose to create a mariaDB, NGINX and a project container for easy developing and…
pBuch
  • 986
  • 1
  • 6
  • 20
13
votes
2 answers

Docker - Can't share data between containers within a volume (docker-compose 3)

I have some containers for a web app for now (nginx, gunicorn, postgres and node to build static files from source and a React server side rendering). In a Dockerfile for the node container I have two steps: build and run (Dockerfile.node). It ends…
Max
  • 404
  • 2
  • 17
  • 39
13
votes
3 answers

expose files from docker container to host

I have a docker container that holds a django app. The static files are produced and copied to a static folder. container folder hierarchy: - var - django - app - static before i build the docker image, i run ./manage.py…
Mr T.
  • 4,278
  • 9
  • 44
  • 61
12
votes
3 answers

Accessing Docker Volume content on MacOS

When I do a docker volume inspect on a Mac, I can see the path to the data, this appears as a /var/lib/docker/volumes/ On a Mac, this link does not exist, because docker runs on inside a very tiny VM. I can use screen…
jwknz
  • 6,598
  • 16
  • 72
  • 115
12
votes
7 answers

Cache Cargo dependencies in a Docker volume

I'm building a Rust program in Docker (rust:1.33.0). Every time code changes, it re-compiles (good), which also re-downloads all dependencies (bad). I thought I could cache dependencies by adding VOLUME ["/usr/local/cargo"]. edit I've also tried…
Mark
  • 18,730
  • 7
  • 107
  • 130
12
votes
1 answer

How best to have files on volumes in Kubernetes using helm charts?

The plan is to move my dockerized application to Kubernetes. The docker container uses couple of files - which I used to mount on the docker volumes by specifying in the docker-compose file: volumes: - ./license.dat:/etc/sys0/license.dat …
Chillax
  • 4,418
  • 21
  • 56
  • 91
12
votes
8 answers

docker-compose on Windows volume not working

I've been playing with Docker for the past week and think the container idea is very useful, but despite reading everything I can for the past 3 days I can't get the volume mapping to work get docker-compose to use my existing volume. Docker…
Maui_Ed
  • 255
  • 1
  • 2
  • 8
12
votes
3 answers

Docker in Docker - volumes not working: Full of files in 1st level container, empty in 2nd tier

I am running Docker in Docker (specifically to run Jenkins which then runs Docker builder containers to build a project images and then runs these and then the test containers). This is how the jenkins image is built and started: docker build --tag…
Ondra Žižka
  • 43,948
  • 41
  • 217
  • 277
12
votes
2 answers

How I can access docker data volumes on Windows machine?

I have docker-compose.yml like this: version: '3' services: mysql: image: mysql volumes: - data:/var/lib/mysql environment: - MYSQL_ROOT_PASSWORD=$ROOT_PASSWORD volumes: data: And my mount point looks like:…
12
votes
2 answers

Docker volume mount doesn't exist

I'm running Docker 1.11 on OS X and I'm trying to figure out where my local volumes are being written. I created a Docker volume by running docker volume create --name mysql. I then ran docker volume inspect mysql and it output the following: [ …
timcase
  • 455
  • 2
  • 4
  • 14
11
votes
2 answers

Docker-Compose not able to copy haproxy.cfg

My problem is that I have a docker-compose.yml file and an haproxy.cfg file and I want docker-compose to copy the haproxy.cfg file to the docker container. As per the post Docker composer copy files I can use volumes to do it but in my case I'm…
utkarsh31
  • 1,439
  • 2
  • 13
  • 20
11
votes
1 answer

docker-compose won't use my named volumes

So I'm fairly new to docker. I have an issue with attaching my named volumes to services in my swarm. Here is my docker-compose.yml... version: '3' services: ned: image: keli ports: - "8080:8080" depends_on: - craig -…
navanjr
  • 558
  • 3
  • 15
11
votes
1 answer

Deploy web app in docker data container vs volume

I'm confused about common consensus that one shouldn't use data containers. I have specific use case that I want to accomplish. I want to have docker nginx container and behind it some other container with application. To run newest version of my…
Zveratko
  • 2,663
  • 6
  • 35
  • 64