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

VOLUME from Dockerfile is not overwritten #5219

Closed
hikhvar opened this issue Feb 15, 2020 · 6 comments · Fixed by #5222
Closed

VOLUME from Dockerfile is not overwritten #5219

hikhvar opened this issue Feb 15, 2020 · 6 comments · Fixed by #5222
Assignees
Labels
kind/bug Categorizes issue or PR as related to a bug. locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments.

Comments

@hikhvar
Copy link
Contributor

hikhvar commented Feb 15, 2020

Is this a BUG REPORT or FEATURE REQUEST? (leave only one on its own line)

/kind bug

Description

I want to run the official teamspeak image. I want to overwrite the data directory with a directory of my own. Neither -v nor --mount will overwrite the VOLUME from the Dockerfile. Podman run will always create a volume. I do not run podman rootless.

Steps to reproduce the issue:

podman run --user 9987:9987 \
 --mount type=bind,src=/mnt/HC_Volume_4317526/teamspeak/data,target=/var/ts3server \
 -v /etc/teamspeak/:/var/run/ts3server/ \
 -p 9987:9987/udp \
 -e TS3SERVER_LICENSE=accept \
 --name teamspeak \
 --network podstack \
 --ip 10.90.0.5

Using -v produces the same result

podman run --user 9987:9987 \
 -v /mnt/HC_Volume_4317526/teamspeak/data:/var/ts3server \
 -v /etc/teamspeak/:/var/run/ts3server/ \
 -p 9987:9987/udp \
 -e TS3SERVER_LICENSE=accept \
 --name teamspeak \
 --network podstack \
 --ip 10.90.0.5

Describe the results you received:

Only the directory /var/run/ts3server is bind mounted to the host:

podman inspect teamspeak | jq '.[0].Mounts'
[
  {
    "Type": "volume",
    "Name": "f66b456a5ada124a47cdcc961af9f8ba27a2bc686af0b650b790e9830be29e52",
    "Source": "/var/lib/containers/storage/volumes/f66b456a5ada124a47cdcc961af9f8ba27a2bc686af0b650b790e9830be29e52/_data",
    "Destination": "/var/ts3server",
    "Driver": "local",
    "Mode": "",
    "Options": [
      "nodev",
      "exec",
      "nosuid",
      "rbind"
    ],
    "RW": true,
    "Propagation": "rprivate"
  },
  {
    "Type": "volume",
    "Name": "f66b456a5ada124a47cdcc961af9f8ba27a2bc686af0b650b790e9830be29e52",
    "Source": "/var/lib/containers/storage/volumes/f66b456a5ada124a47cdcc961af9f8ba27a2bc686af0b650b790e9830be29e52/_data",
    "Destination": "/var/ts3server",
    "Driver": "local",
    "Mode": "",
    "Options": [
      "nodev",
      "exec",
      "nosuid",
      "rbind"
    ],
    "RW": true,
    "Propagation": "rprivate"
  },
  {
    "Type": "bind",
    "Name": "",
    "Source": "/etc/teamspeak",
    "Destination": "/var/run/ts3server",
    "Driver": "",
    "Mode": "",
    "Options": [
      "rbind"
    ],
    "RW": true,
    "Propagation": "rprivate"
  }
]

Describe the results you expected:

I expected to both /var/run/ts3server and /var/ts3server to be bind mounted to the host

Additional information you deem important (e.g. issue happens only occasionally):

Output of podman version:

Version:            1.8.0
RemoteAPI Version:  1
Go Version:         go1.10.1
OS/Arch:            linux/amd64

Output of podman info --debug:

debug:
  compiler: gc
  git commit: ""
  go version: go1.10.1
  podman version: 1.8.0
host:
  BuildahVersion: 1.13.1
  CgroupVersion: v1
  Conmon:
    package: 'conmon: /usr/libexec/podman/conmon'
    path: /usr/libexec/podman/conmon
    version: 'conmon version 2.0.10, commit: unknown'
  Distribution:
    distribution: ubuntu
    version: "18.04"
  MemFree: 1164185600
  MemTotal: 2039586816
  OCIRuntime:
    name: runc
    package: 'cri-o-runc: /usr/lib/cri-o-runc/sbin/runc'
    path: /usr/lib/cri-o-runc/sbin/runc
    version: 'runc version spec: 1.0.1-dev'
  SwapFree: 0
  SwapTotal: 0
  arch: amd64
  cpus: 1
  eventlogger: journald
  hostname: main-vps
  kernel: 4.15.0-76-generic
  os: linux
  rootless: false
  uptime: 2h 16m 30.79s (Approximately 0.08 days)
registries:
  search:
  - docker.io
  - quay.io
store:
  ConfigFile: /etc/containers/storage.conf
  ContainerStore:
    number: 6
  GraphDriverName: overlay
  GraphOptions: {}
  GraphRoot: /var/lib/containers/storage
  GraphStatus:
    Backing Filesystem: extfs
    Native Overlay Diff: "true"
    Supports d_type: "true"
    Using metacopy: "false"
  ImageStore:
    number: 6
  RunRoot: /var/run/containers/storage
  VolumePath: /var/lib/containers/storage/volumes


Package info (e.g. output of rpm -q podman or apt list podman):

apt show podman
Package: podman
Version: 1.8.0~2
Priority: optional
Section: devel
Maintainer: Lokesh Mandvekar <lsm5@fedoraproject.org>
Installed-Size: 76.4 MB
Depends: libseccomp2, libdevmapper1.02.1, libgpgme11, conmon (>= 1.0.0), containers-common (>= 0.1.40-9), cri-o-runc, iptables
Recommends: slirp4netns, containernetworking-plugins (>= 0.8.1), uidmap, varlink
Homepage: https://github.com/containers/libpod.git
Download-Size: 16.0 MB
APT-Manual-Installed: yes
APT-Sources: http://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/stable/xUbuntu_18.04  Packages
Description: Manage pods, containers and container images.


Additional environment details (AWS, VirtualBox, physical, etc.):

The box is a generic Hetzner Cloud VM.
Configuration of the podstack network:

{
   "cniVersion": "0.4.0",
   "name": "podstack",
   "plugins": [
      {
         "type": "bridge",
         "bridge": "cni-podstack",
         "isGateway": true,
         "ipMasq": true,
         "ipam": {
            "type": "host-local",
            "routes": [
               {
                  "dst": "0.0.0.0/0"
               }
            ],
            "ranges": [
               [
                  {
                     "subnet": "10.90.0.0/24",
                     "gateway": "10.90.0.1"
                  }
               ]
            ]
         }
      },
      {
         "type": "portmap",
         "capabilities": {
            "portMappings": true
         }
      },
      {
         "type": "firewall",
         "backend": "iptables"
      }
   ]
}
@openshift-ci-robot openshift-ci-robot added the kind/bug Categorizes issue or PR as related to a bug. label Feb 15, 2020
@mheon
Copy link
Member

mheon commented Feb 16, 2020

I'll take this one

@mheon mheon self-assigned this Feb 16, 2020
@mheon
Copy link
Member

mheon commented Feb 16, 2020

Can you provide the name of the image being used in the examples here? I can't reproduce with Podman 1.8.0 trying to mount over an image volume in a custom-built image, so it might be specific to this image.

@mheon
Copy link
Member

mheon commented Feb 16, 2020

Actually, just a podman inspect of the image would help a lot... My initial suspicion is that there's something slightly different about this volume mount (trailing / maybe? Something messing up our normal comparison) and inspect should tell us that path

@hikhvar
Copy link
Contributor Author

hikhvar commented Feb 16, 2020 via email

mheon added a commit to mheon/libpod that referenced this issue Feb 16, 2020
We use filepath.Clean() to remove trailing slashes to ensure that
when we supercede image mounts with mounts from --volume and
--mount, paths are consistent when we compare. Unfortunately,
while we used the cleaned path for the destination in the mount,
it was accidentally not used to index the maps that we use to
identify what to supercede, so our comparisons might be thrown
off by trailing slashes and similar.

Fixes containers#5219

Signed-off-by: Matthew Heon <matthew.heon@pm.me>
@mheon
Copy link
Member

mheon commented Feb 16, 2020

#5222 to fix

mheon added a commit to mheon/libpod that referenced this issue Feb 17, 2020
We use filepath.Clean() to remove trailing slashes to ensure that
when we supercede image mounts with mounts from --volume and
--mount, paths are consistent when we compare. Unfortunately,
while we used the cleaned path for the destination in the mount,
it was accidentally not used to index the maps that we use to
identify what to supercede, so our comparisons might be thrown
off by trailing slashes and similar.

Fixes containers#5219

Signed-off-by: Matthew Heon <matthew.heon@pm.me>
mheon added a commit to mheon/libpod that referenced this issue Feb 17, 2020
We use filepath.Clean() to remove trailing slashes to ensure that
when we supercede image mounts with mounts from --volume and
--mount, paths are consistent when we compare. Unfortunately,
while we used the cleaned path for the destination in the mount,
it was accidentally not used to index the maps that we use to
identify what to supercede, so our comparisons might be thrown
off by trailing slashes and similar.

Fixes containers#5219

Signed-off-by: Matthew Heon <matthew.heon@pm.me>
mheon added a commit to mheon/libpod that referenced this issue Feb 17, 2020
We use filepath.Clean() to remove trailing slashes to ensure that
when we supercede image mounts with mounts from --volume and
--mount, paths are consistent when we compare. Unfortunately,
while we used the cleaned path for the destination in the mount,
it was accidentally not used to index the maps that we use to
identify what to supercede, so our comparisons might be thrown
off by trailing slashes and similar.

Fixes containers#5219

Signed-off-by: Matthew Heon <matthew.heon@pm.me>
@hikhvar
Copy link
Contributor Author

hikhvar commented Feb 21, 2020

Thank you for that quick fix!

snj33v pushed a commit to snj33v/libpod that referenced this issue May 31, 2020
We use filepath.Clean() to remove trailing slashes to ensure that
when we supercede image mounts with mounts from --volume and
--mount, paths are consistent when we compare. Unfortunately,
while we used the cleaned path for the destination in the mount,
it was accidentally not used to index the maps that we use to
identify what to supercede, so our comparisons might be thrown
off by trailing slashes and similar.

Fixes containers#5219

Signed-off-by: Matthew Heon <matthew.heon@pm.me>
@github-actions github-actions bot added the locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments. label Sep 23, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 23, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
kind/bug Categorizes issue or PR as related to a bug. locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants