Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrect documentation docker volume create #47606

Open
g-kartik opened this issue Mar 21, 2024 · 1 comment · May be fixed by #47798
Open

Incorrect documentation docker volume create #47606

g-kartik opened this issue Mar 21, 2024 · 1 comment · May be fixed by #47798
Labels
area/docs area/volumes kind/bug Bugs are bugs. The cause may or may not be known at triage time so debugging may be needed. status/0-triage

Comments

@g-kartik
Copy link

Description

Trying to create two volumes with same name should throw error as mention in the docs https://docs.docker.com/reference/cli/docker/volume/create/. However there is no error thrown and it just returns the volume name. I think this is not documented.

Reproduce

  1. docker volume create <exisiting_volume_name>

Expected behavior

The docs need to be updated

docker version

Client:
 Cloud integration: v1.0.35+desktop.10
 Version:           24.0.7
 API version:       1.43
 Go version:        go1.21.3
 Git commit:        afdd53b4e3
 Built:             Sun Oct 29 15:42:02 2023
 OS/Arch:           linux/amd64
 Context:           default

Server:
 Engine:
  Version:          24.0.7
  API version:      1.43 (minimum version 1.12)
  Go version:       go1.21.3
  Git commit:       311b9ff0aa
  Built:            Sun Oct 29 15:42:02 2023
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          v1.7.11
  GitCommit:        64b8a811b07ba6288238eefc14d898ee0b5b99ba.m
 runc:
  Version:          1.1.10
  GitCommit:        
 docker-init:
  Version:          0.19.0
  GitCommit:        de40ad0

docker info

Client:
 Version:    24.0.7
 Context:    default
 Debug Mode: false
 Plugins:
  buildx: Docker Buildx (Docker Inc.)
    Version:  v0.12.1-desktop.4
    Path:     /usr/lib/docker/cli-plugins/docker-buildx
  compose: Docker Compose (Docker Inc.)
    Version:  v2.24.5-desktop.1
    Path:     /usr/lib/docker/cli-plugins/docker-compose
  debug: Get a shell into any image or container. (Docker Inc.)
    Version:  0.0.24
    Path:     /usr/lib/docker/cli-plugins/docker-debug
  dev: Docker Dev Environments (Docker Inc.)
    Version:  v0.1.0
    Path:     /usr/lib/docker/cli-plugins/docker-dev
  extension: Manages Docker extensions (Docker Inc.)
    Version:  v0.2.21
    Path:     /usr/lib/docker/cli-plugins/docker-extension
  feedback: Provide feedback, right in your terminal! (Docker Inc.)
    Version:  v1.0.4
    Path:     /usr/lib/docker/cli-plugins/docker-feedback
  init: Creates Docker-related starter files for your project (Docker Inc.)
    Version:  v1.0.0
    Path:     /usr/lib/docker/cli-plugins/docker-init
  sbom: View the packaged-based Software Bill Of Materials (SBOM) for an image (Anchore Inc.)
    Version:  0.6.0
    Path:     /usr/lib/docker/cli-plugins/docker-sbom
  scout: Docker Scout (Docker Inc.)
    Version:  v1.4.1
    Path:     /usr/lib/docker/cli-plugins/docker-scout

Server:
 Containers: 8
  Running: 8
  Paused: 0
  Stopped: 0
 Images: 22
 Server Version: 24.0.7
 Storage Driver: overlay2
  Backing Filesystem: extfs
  Supports d_type: true
  Using metacopy: true
  Native Overlay Diff: false
  userxattr: false
 Logging Driver: json-file
 Cgroup Driver: systemd
 Cgroup Version: 2
 Plugins:
  Volume: local
  Network: bridge host ipvlan macvlan null overlay
  Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog
 Swarm: inactive
 Runtimes: io.containerd.runc.v2 runc
 Default Runtime: runc
 Init Binary: docker-init
 containerd version: 64b8a811b07ba6288238eefc14d898ee0b5b99ba.m
 runc version: 
 init version: de40ad0
 Security Options:
  seccomp
   Profile: builtin
  cgroupns
 Kernel Version: 6.6.5-arch1-1
 Operating System: Arch Linux
 OSType: linux
 Architecture: x86_64
 CPUs: 8
 Total Memory: 19.45GiB
 Name: archlinux
 ID: c755af18-ccd5-4262-9be4-a17d19c101b2
 Docker Root Dir: /var/lib/docker
 Debug Mode: false
 Username: gkarthikraja
 Experimental: false
 Insecure Registries:
  127.0.0.0/8
 Live Restore Enabled: false

Additional Info

No response

@g-kartik g-kartik added kind/bug Bugs are bugs. The cause may or may not be known at triage time so debugging may be needed. status/0-triage labels Mar 21, 2024
@g-kartik g-kartik changed the title Incorrect documentation Incorrect documentation docker volume create Mar 21, 2024
Anish-M added a commit to Anish-M/moby that referenced this issue May 5, 2024
Anish-M added a commit to Anish-M/moby that referenced this issue May 5, 2024
@thaJeztah
Copy link
Member

I don't think this is a bug, but the documentation may need a more complete example; https://docs.docker.com/reference/cli/docker/volume/create/

Screenshot 2024-05-06 at 12 25 33

The important part here is that the name must be unique across drivers, so no 2 volumes should be allowed with the same name across multiple drivers, but for the same driver, it's treated as an idempotent action;

If you specify a volume name already in use on the current driver, Docker assumes you want to re-use the existing volume and doesn't return an error.

I once opened a ticket to suggest it should always be an error, but that ship likely sailed, and may be too late now to change that behavior;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/docs area/volumes kind/bug Bugs are bugs. The cause may or may not be known at triage time so debugging may be needed. status/0-triage
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants