Mode option in tmpfs volume is ignored when deployed via docker stack deploy

オープン 初心者向け
#7,454 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

@locker95 がすでに取り組んでいます。

2026年11月2日 から。

  • #7455 @locker95 による — オープン
  • #7496 @Mhdomer による — マージされずにクローズ

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
70/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
活発
技術スタック
docker, go
領域
cli

調査の方向性

リンクされた SwarmKit のコメントで破棄されるオプションの原因として特定されている、Docker CLI の Compose コンバーターから始めて、tmpfs.size をサービスのマウントにコピーする方法を確認してください。近くにある変換テストを読み、tmpfs.mode が対象になっているか確認してください。完了条件は、docker stack deploy が設定されたモードを保持し、その変換を対象とするテストがあることです。

索引モデルが issue の本文から書いたものです。

説明

kind/bug status/0-triage
Description

The mode option of tmpfs volumes is ignored in swarm mode, when deployed via docker stack deploy.

compose.yaml:

services:
  alpine:
    image: alpine:3.20
    command: ["sh", "-c", "while true; do sleep 3600; done"]
    volumes:
      - type: tmpfs
        target: /run
        tmpfs:
          size: 268435456
          mode: 01777

In the resulting container the mode is not applied:

/ # ls -ld /run
drwxr-xr-x    2 root     root            40 Nov  2 20:57 /run
# docker -v
Docker version 29.9.2, build a82e528

@dperny commented on the issue I initially filed on the moby/swarmkit project:

Thanks for the report. Assuming this was deployed with docker stack deploy, this is a real bug, but it is in the Docker CLI rather than swarmkit: the CLI's compose converter copies only tmpfs.size into the service mount and drops tmpfs.mode, while swarmkit and the Engine pass the mode through. I couldn't find a docker/cli issue for it, so please open one at https://github.com/docker/cli/issues, where the fix belongs. As a workaround, docker service create --mount type=tmpfs,destination=/run,tmpfs-mode=1777 does set the mode (https://docs.docker.com/reference/cli/docker/service/create/#options-for-tmpfs). Closing here, since no swarmkit change can fix it.

Reproduce
  1. docker stack deploy the above compose file
  2. enter the container and check the volume's mode
Expected behavior

Mode is set to rwx for all

docker version
Client: Docker Engine - Community
 Version:           29.9.2
 API version:       1.56
 Go version:        go1.26.10
 Git commit:        a82e528
 Built:             Tue Oct 20 18:45:13 2026
 OS/Arch:           linux/amd64
 Context:           default

Server: Docker Engine - Community
 Engine:
  Version:          29.9.2
  API version:      1.56 (minimum version 1.40)
  Go version:       go1.26.10
  Git commit:       0367cbe
  Built:            Tue Oct 20 18:45:13 2026
  OS/Arch:          linux/amd64
  Experimental:     true
 containerd:
  Version:          v2.4.2
  GitCommit:        b7a25261e029d68978bbf290df0a62fc819b3c51
 runc:
  Version:          1.5.2
  GitCommit:        v1.5.2-0-g29dd3dc2
 docker-init:
  Version:          0.19.0
  GitCommit:        de40ad0
docker info
Client: Docker Engine - Community
Version:    29.9.2
Context:    default
Debug Mode: false
Plugins:
  buildx: Docker Buildx (Docker Inc.)
    Version:  v0.38.1
    Path:     /usr/libexec/docker/cli-plugins/docker-buildx
  compose: Docker Compose (Docker Inc.)
    Version:  v5.7.0
    Path:     /usr/libexec/docker/cli-plugins/docker-compose

Server:
Containers: 7
  Running: 7
  Paused: 0
  Stopped: 0
Images: 37
Server Version: 29.9.2
Storage Driver: overlayfs
  driver-type: io.containerd.snapshotter.v1
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 splunk syslog
CDI spec directories:
  /etc/cdi
  /var/run/cdi
Swarm: active
  NodeID: anonymizednodeid000000000
  Is Manager: false
  Node Address: <REDACTED>
  Manager Addresses:
   <REDACTED>:2377
   <REDACTED>:2377
   <REDACTED>:2377
Runtimes: io.containerd.runc.v2 runc
Default Runtime: runc
Init Binary: docker-init
containerd version: b7a25261e029d68978bbf290df0a62fc819b3c51
runc version: v1.5.2-0-g29dd3dc2
init version: de40ad0
Security Options:
  apparmor
   Profile: default
  seccomp
   Profile: builtin
  cgroupns
Kernel Version: 6.12.115+deb13.1-amd64
Operating System: Debian GNU/Linux 13 (trixie)
OSType: linux
Architecture: x86_64
CPUs: 32
Total Memory: 125.7GiB
Name: node02
ID: 00000000-0000-0000-0000-000000000000
Docker Root Dir: /var/lib/docker
Debug Mode: false
Experimental: true
Insecure Registries:
  127.0.0.0/8
  ::1/128
Live Restore Enabled: false
Firewall Backend: iptables
  EnableUserlandProxy: true
  UserlandProxyPath: /usr/bin/docker-proxy
Additional Info

No response

主要言語
Go
スター
6.1k
フォーク
2.2k
平均マージ
1日 8時間
マージ済み PR(30日)
62

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

docker/cli のほかの issue

docker/cli の issue をすべて見る

似ている issue

Go の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。