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
39
votes
2 answers

docker run with --volume

I'm trying to dockerize some services for development on my machine and wondering how docker run --volume=.. works. For example, if I do something like docker run --volume=/path/to/data:/data [...] will /path/to/data be (re)created locally only if…
planetp
  • 14,248
  • 20
  • 86
  • 160
33
votes
3 answers

Undefined volume with Docker Compose

I wanted to translate this docker CLI command (from smallstep/step-ca) into a docker-compose.yml file to run with docker compose (version 2): docker run -d -v step:/home/step \ -p 9000:9000 \ -e "DOCKER_STEPCA_INIT_NAME=Smallstep" \ -e…
Connor Low
  • 5,900
  • 3
  • 31
  • 52
33
votes
6 answers

Is there a way to determine the size of a docker volume on my macOS machine?

I'm aware of docker volume ls and docker inspect -s, but the former doesn't show size info and the latter, even though it has a --size option, ignores it for volumes. Is there something I'm missing?
Bonifacio2
  • 3,405
  • 6
  • 34
  • 54
32
votes
1 answer

How can I mount a volume of files to a remote docker daemon?

I have a Docker image a which does some logic on a given set of files. When running locally, I start a as following: docker run -v /home/Bradson/data:/data a This does its job. Now I want to run a on a remote Docker…
Bradson
  • 615
  • 1
  • 6
  • 9
31
votes
5 answers

Mysql docker container keeps restarting

The Container keeps restarting. I tried docker-compose down -v docker volume rm The container was working fine earlier. Logs 2021-03-27 13:16:08+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 8.0.23-1debian10 started. 2021-03-27…
Shimron Duan
  • 391
  • 1
  • 3
  • 9
31
votes
3 answers

How to create docker volume device/host path

I believe there is an easy way to copy files into a docker volume that has already been mounted to a container. docker cp /tmp/my_data/. my_container:/my_data as referenced by How to copy multiple files into a docker data volume But, how does one…
loonyuni
  • 1,373
  • 3
  • 16
  • 24
28
votes
1 answer

Recreate named volume with compose

-V, --renew-anon-volumes Recreate anonymous volumes instead of retrieving data from the previous containers. Does docker-compose up -V not apply to named volumes? I have a service that, at image build time, pulls…
Slav
  • 27,057
  • 11
  • 80
  • 104
28
votes
3 answers

Docker add network drive as volume on windows

I am trying to mount a network drive as a volume. This is the command I am trying docker run -v //NetworkDirectory/Folder:/data alpine ls /data I am running this command on windows and the data directory is coming up empty. How can I mount this…
Salmaan P
  • 817
  • 1
  • 12
  • 32
28
votes
1 answer

How to share data between host and containers using volumes in Docker Compose

I am playing with Docker Compose and volumes version: '2' services: php-apache: env_file: - dev_variables.env image: reypm/php55-dev build: context: . args: - PUID=1000 …
ReynierPM
  • 17,594
  • 53
  • 193
  • 363
27
votes
4 answers

Docker Anonymous Volumes

I've seen Docker volume definitions in docker-compose.yml files like so: -v /path/on/host/modules:/var/www/html/modules I noticed that Drupal's official image, their docker-compose.yml file is using anonymous volumes. Notice the comments: volumes: …
Raphael Rafatpanah
  • 19,082
  • 25
  • 92
  • 158
27
votes
4 answers

docker-compose volume on node_modules but is empty

I'm pretty new with Docker and i wanted to map the node_modules folder on my computer (for debugging purpose). This is my docker-compose.yml web: build: . ports: - "3000:3000" links: - db environment: PORT: 3000 volumes: -…
Mike Boutin
  • 5,297
  • 12
  • 38
  • 65
27
votes
3 answers

How to copy data from docker volume to host?

I have created a docker volume "hello" and it contains some data . How can I copy the data to host ? First : kerydeMacBook-Pro:~ hu$ docker volume create --name hello hello checking : kerydeMacBook-Pro:~ hu$ docker volume ls DRIVER …
Kery Hu
  • 5,626
  • 11
  • 34
  • 51
24
votes
6 answers

Kubernetes Secrets Volumes vs Environment Variables

Is there a recommended way to use Kubernetes Secrets? They can be exposed as environment variables or using a volume mount. Is one more secure than the other?
23
votes
2 answers

docker-compose.yml Syntax for Named Volumes

What is the docker-compose.yml syntax for specifying the host path of a named volume? docker-compose.yml: volumes: myvolume: # how do I specify path here? othervolume: services: # etc... I've checked the docs, but I can't find it. Honestly, I…
Petrus Theron
  • 27,855
  • 36
  • 153
  • 287
23
votes
3 answers

Docker named volume not updating

I am confused on how the named data-volume (not data container) should be used. I have a named data volume app_src that is mounted to /usr/src/app using docker compose file. However, after making changes to my source code (locally), building the…
Shulhi Sapli
  • 2,286
  • 3
  • 21
  • 31
1
2
3
93 94