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

'podman run --volume .:/whatever' panics (relative path source) #2301

Closed
wking opened this issue Feb 9, 2019 · 5 comments
Closed

'podman run --volume .:/whatever' panics (relative path source) #2301

wking opened this issue Feb 9, 2019 · 5 comments
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

@wking
Copy link
Contributor

wking commented Feb 9, 2019

/kind bug

Description

I naively passed a relative path source into --volume and panicked podman.

Steps to reproduce the issue:

$ podman pull quay.io/quay/busybox
$ podman run --rm --volume .:/whatever quay.io/quay/busybox ls /
ERRO[0000] error creating named volume ".": error running volume create option: name must match regex [a-zA-Z0-9_-]+: invalid argument 
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x1102c53]

goroutine 1 [running]:
github.com/containers/libpod/libpod.(*Volume).MountPoint(...)
	/.../go/src/github.com/containers/libpod/libpod/volume.go:46
github.com/containers/libpod/libpod.(*Runtime).newContainer(0xc420312620, 0x16c5a00, 0xc4200400e0, 0xc42003a300, 0xc42003a780, 0xf, 0x10, 0x0, 0x0, 0x0)
	/.../go/src/github.com/containers/libpod/libpod/runtime_ctr.go:180 +0x953
github.com/containers/libpod/libpod.(*Runtime).NewContainer(0xc420312620, 0x16c5a00, 0xc4200400e0, 0xc42003a300, 0xc42003a780, 0xf, 0x10, 0x0, 0x0, 0x0)
	/.../go/src/github.com/containers/libpod/libpod/runtime_ctr.go:43 +0xe3
main.createContainerFromCreateConfig(0xc420312620, 0xc420476580, 0x16c5a00, 0xc4200400e0, 0x0, 0x1b, 0xc42027ab40, 0xc420476580)
	/.../go/src/github.com/containers/libpod/cmd/podman/create.go:880 +0x144
main.createContainer(0x23f11c0, 0xc420312620, 0x0, 0x0, 0x0, 0x0)
	/.../go/src/github.com/containers/libpod/cmd/podman/create.go:155 +0x1d3
main.runCmd(0x23f11c0, 0x0, 0x0)
	/.../go/src/github.com/containers/libpod/cmd/podman/run.go:61 +0xeb
main.glob..func33(0x224f220, 0xc42035d800, 0x3, 0x6, 0x0, 0x0)
	/.../go/src/github.com/containers/libpod/cmd/podman/run.go:31 +0x80
github.com/containers/libpod/vendor/github.com/spf13/cobra.(*Command).execute(0x224f220, 0xc42003a0a0, 0x6, 0x6, 0x224f220, 0xc42003a0a0)
	/.../go/src/github.com/containers/libpod/vendor/github.com/spf13/cobra/command.go:762 +0x468
github.com/containers/libpod/vendor/github.com/spf13/cobra.(*Command).ExecuteC(0x2250060, 0x2d, 0x2416d80, 0xc420436c00)
	/.../go/src/github.com/containers/libpod/vendor/github.com/spf13/cobra/command.go:852 +0x30a
github.com/containers/libpod/vendor/github.com/spf13/cobra.(*Command).Execute(0x2250060, 0xc4204f5f78, 0x40aadc)
	/.../go/src/github.com/containers/libpod/vendor/github.com/spf13/cobra/command.go:800 +0x2b
main.main()
	/.../go/src/github.com/containers/libpod/cmd/podman/main.go:179 +0x42

Describe the results you expected:

I expected this to mount the current working directory into the container.

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

Reading this comment, I see that I should have used an absolute path and that podman is treating my . as a named volume and then crashing in error handling. And it looks like the user docs call out absolute paths here and here, although I don't see the non-absolute-path named-volume case discussed there.

Output of podman version:

$ podman version
Version:            1.0.1-dev
RemoteAPI Version:  1
Go Version:         go1.10.3
Git Commit:         "afd4d5f4a4b05f421e6f336b4d74a0d808be57ed"
Built:              Fri Feb  8 21:34:05 2019
OS/Arch:            linux/amd64
$ podman info
host:
  BuildahVersion: 1.7-dev
  Conmon:
    package: podman-0.10.1.3-1.gitdb08685.el7.x86_64
    path: /usr/libexec/podman/conmon
    version: 'conmon version 1.12.0-dev, commit: 0e7abf050824203d775a20c26ed14f716f7d1aa7-dirty'
  Distribution:
    distribution: '"rhel"'
    version: "7.5"
  MemFree: 2298761216
  MemTotal: 16289890304
  OCIRuntime:
    package: runc-1.0.0-52.dev.git70ca035.el7_5.x86_64
    path: /usr/bin/runc
    version: 'runc version spec: 1.0.0'
  SwapFree: 8011378688
  SwapTotal: 8254386176
  arch: amd64
  cpus: 8
  hostname: trking.remote.csb
  kernel: 3.10.0-891.el7.x86_64
  os: linux
  rootless: false
  uptime: 252h 1m 2.2s (Approximately 10.50 days)
insecure registries:
  registries: []
registries:
  registries:
  - registry.access.redhat.com
store:
  ConfigFile: /etc/containers/storage.conf
  ContainerStore:
    number: 13
  GraphDriverName: overlay
  GraphOptions: null
  GraphRoot: /var/lib/containers/storage
  GraphStatus:
    Backing Filesystem: extfs
    Native Overlay Diff: "true"
    Supports d_type: "true"
    Using metacopy: "false"
  ImageStore:
    number: 23
  RunRoot: /var/run/containers/storage
@openshift-ci-robot openshift-ci-robot added the kind/bug Categorizes issue or PR as related to a bug. label Feb 9, 2019
@mheon
Copy link
Member

mheon commented Feb 9, 2019 via email

@rhatdan
Copy link
Member

rhatdan commented Feb 9, 2019

#2229 should fix this issue.

@rhatdan rhatdan closed this as completed Feb 23, 2019
@chpio
Copy link

chpio commented Mar 25, 2019

im still getting an error: Error: error creating named volume ".": error running volume create option: name must match regex [a-zA-Z0-9_-]+: invalid argument

$ podman version
Version:            1.2.0-dev
RemoteAPI Version:  1
Go Version:         go1.10.4
OS/Arch:            linux/amd64

Is this the intended behavior? So local volumes are not supported? Is there a workaround to get local volumes to work with podman?

@mheon
Copy link
Member

mheon commented Mar 25, 2019

@chpio Working on a fix for this one now, actually

@mheon
Copy link
Member

mheon commented Mar 25, 2019

@chpio Specifically, the issue here is that we're not interpreting . and .. (and paths prefixed by those) as relative paths, but trying to use them as volume names. Using `pwd`:$PATH_IN_CONTAINER for now should work around it.

@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 24, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 24, 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

No branches or pull requests

5 participants