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
7
votes
1 answer

Docker volume: persist data on a remote host

https://docs.docker.com/storage/#more-details-about-mount-types Good use cases for volumes When you want to store your container’s data on a remote host or a cloud provider, rather than locally. How is this accomplished with docker volume?…
ealeon
  • 12,074
  • 24
  • 92
  • 173
7
votes
2 answers

How to actually bind mount a file in Docker for Windows

I'm attempting to update the sebp/elk Logstash configuration following the documentation here. I'm running into a situation in which the host file that I am attempting to mount is being mounted as a directory in the container. I found this related…
swasheck
  • 4,644
  • 2
  • 29
  • 56
7
votes
1 answer

Mount a volume while using a docker container in Azure App Service

I've deployed a Web App on Azure and use a Docker Container from the public registry (my own image) to host my website. But users can upload pictures and data is stored in json-files on the server. Of course I want to write these files to a mounted…
riezebosch
  • 1,950
  • 16
  • 29
7
votes
1 answer

How to keep Docker container volume files?

I'd like to share ~/mydir directory with host, but not replace Docker container directory with host files. So, I have docker-compose.yml version: '2' services: app: container_name: mono build: . volumes: # save .composer files on…
Kirby
  • 2,847
  • 2
  • 32
  • 42
7
votes
2 answers

Docker volume option create folder as "root" user

I am logged in in my PC (Fedora 24) as rperez. I have setup Docker for being able to run through this user, so I am running a container as follow: $ docker run -d \ -it \ -e HOST_IP=192.168.1.66 \ -e…
ReynierPM
  • 17,594
  • 53
  • 193
  • 363
7
votes
1 answer

Dockerfile, persist data with VOLUME

Please bear with me as I learn my way around docker. I'm using v1.11.1 I am making a Dockerfile and would like to specify that a folder of the container should be persisted, this should only be persisted per user (computer running the container). I…
Pomme.Verte
  • 1,782
  • 1
  • 15
  • 32
7
votes
2 answers

Docker Volumes when updating the image

I'm newbie with Docker and I'm trying to better understand the Volumes topic. Here I see that: 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…
net.cat
  • 131
  • 1
  • 4
  • 8
7
votes
1 answer

How to share local files to docker container In swarm with docker-compose

here is my docker compose file version: '2' services: demoui: image: demoimage ports: - "80:8000" volumes: - ./democonfig/config.js:/usr/local/tomcat/webapps/demo-ui/config.js - ./logs/demo-ui:/usr/local/tomcat/logs restart:…
vimal prakash
  • 1,503
  • 1
  • 22
  • 38
7
votes
1 answer

Replicate 'docker volume create --name data' command on docker-compose.yml

I'm building my containers with docker-compose and I would like to use the new volume API from Docker, but I don't see how to. I want to be able to say docker-compose up -d to: Create a volume, or use it if already created. Create services…
Juan C. Irizar
  • 105
  • 2
  • 8
6
votes
1 answer

Solving a Docker compose scenario involving dependant resources shared by containers?

I'm learning Docker and I'm facing the following issue, mainly related to sharing files between services. I've prepared an illustration: I have 3 stages in my Dockerfile: builder, php and caddy. My docker-compose.yml defines 2 services: php and…
gremo
  • 47,186
  • 75
  • 257
  • 421
6
votes
1 answer

How to specify userid and groupid for volume mount point on Docker host

I have been frustrated by this issue for a while because this has been asked multiple times here, such as in How to deal with persistent storage (e.g. databases) in Docker and What is the (best) way to manage permissions for Docker shared volumes?,…
Naju
  • 145
  • 2
  • 12
6
votes
1 answer

How to shrink Docker disk image, but keep volumes in Docker for Mac?

When decreasing the size of the Docker disk image, Docker for Mac gives a warning, that it will delete all images, containers and volumes. I don't mind losing the images and containers, but is there a way to preserve the volumes? Is there a way to…
Alexander Popov
  • 23,073
  • 19
  • 91
  • 130
6
votes
3 answers

Permission denied when persisting a container of mcr.microsoft.com/mssql/server:2019-latest using Docker volumes

On Windows 10, using Docker desktop version 2.1.0.5. I have been successfully using the image microsoft/mssql-server-linux:2017-latest, but since it is deprecated, I am changing it to mcr.microsoft.com/mssql/server:2019-latest, where I experience…
Dr. Strangelove
  • 2,725
  • 3
  • 34
  • 61
6
votes
2 answers

How to manage permissions for a volume mounted into a docker container?

I'm developing a Wordpress theme, and want to use Docker in my dev setup. What I've done is pretty simple: create a database service running MySQL 5.7 create a wordpress service, where I mount my theme folder as a volume into…
idix
  • 433
  • 1
  • 6
  • 13
6
votes
1 answer

How can Docker container write to a mounted directory with permissions granted through group membership?

Versions Host OS: Debian 4.9.110 Docker Version: 18.06.1-ce Scenario I have a directory where multiple users (user-a and user-b) have read/write access through a common group membership (shared), set up via chown: /media/disk-a/shared/$ ls…
manu
  • 967
  • 1
  • 11
  • 28