containers / podman

Podman: A tool for managing OCI containers and pods.
https://podman.io
Apache License 2.0
23.59k stars 2.4k forks source link

podman does not create the /.dockerenv file inside the container #1583

Closed mbaldessari closed 6 years ago

mbaldessari commented 6 years ago

Is this a BUG REPORT or FEATURE REQUEST?:

[//]: # Uncomment only one, leave it on its own line:

[//]: kind bug

[//]: # kind feature

Description

$ podman run --name=test0 -it --rm --net=host  --user=root  docker.io/sdelrio/docker-minimal-nginx sh -c 'ls -l /.dockerenv'
ls: /.dockerenv: No such file or directory
See '/usr/bin/docker-current run --help'.
$ sudo docker run --name=test0 -it --rm --net=host  --user=root  docker.io/sdelrio/docker-minimal-nginx sh -c 'ls -l /.dockerenv'
-rwxr-xr-x    1 root     root             0 Oct  3 14:02 /.dockerenv

Describe the results you expected: There are likely tools out there (I know we check this at least in puppet-pacemaker via a facter check) that rely on that file being available to have a very simple means to detect if we're running inside a container. Likely there are more tools out there relying on this.

This was tested on updated (as of today) F28.

Output of podman version:

Version:       0.9.1
Go Version:    go1.10.4
OS/Arch:       linux/amd64

Output of podman info:

host:
  Conmon:
    package: podman-0.9.1-3.gitaba58d1.fc28.x86_64
    path: /usr/libexec/podman/conmon
    version: 'conmon version 1.12.0-dev, commit: 1d75f1d54e9e123a97e7f505e38df7ab7192cfa7-dirty'
  MemFree: 10172403712
  MemTotal: 16695508992
  OCIRuntime:
    package: runc-1.0.0-51.dev.gitfdd8055.fc28.x86_64
    path: /usr/bin/runc
    version: 'runc version spec: 1.0.0'
  SwapFree: 0
  SwapTotal: 0
  arch: amd64
  cpus: 8
  hostname: holtby
  kernel: 4.18.10-200.fc28.x86_64
  os: linux
  uptime: 8h 12m 37.25s (Approximately 0.33 days)
insecure registries:
  registries: []
registries:
  registries:
  - docker.io
  - registry.fedoraproject.org
  - quay.io
  - registry.access.redhat.com
  - registry.centos.org
store:
  ContainerStore:
    number: 9
  GraphDriverName: vfs
  GraphOptions: []
  GraphRoot: /home/michele/.local/share/containers/storage
  GraphStatus: {}
  ImageStore:
    number: 3
  RunRoot: /run/user/1000/run
mheon commented 6 years ago

We create a .containerenv file instead (after some past debate on this subject - we're somewhat reluctant to use the Docker name). This is definitely not good for preexisting tools, though. @rhatdan are we still firm on leaving this as-is?

miabbott commented 6 years ago

I've been down this path, too :wink: https://github.com/containers/libpod/issues/648

mbaldessari commented 6 years ago

Ack thanks, I am fine with tweaking my code to use /run/.containerenv. Shall we close this as a dupe of https://github.com/containers/libpod/issues/648 ?