podman/libpod
Daniel J Walsh 5d1ec2960d
Do not reset storage when running inside of a container
Currently if the host shares container storage with a container
running podman, the podman inside of the container resets the
storage on the host. This can cause issues on the host, as
well as causes the podman command running the container, to
fail to unmount /dev/shm.

podman run -ti --rm --privileged -v /var/lib/containers:/var/lib/containers quay.io/podman/stable podman run alpine echo hello
	* unlinkat /var/lib/containers/storage/overlay-containers/a7f3c9deb0656f8de1d107e7ddff2d3c3c279c11c1635f233a0bffb16051fb2c/userdata/shm: device or resource busy
	* unlinkat /var/lib/containers/storage/overlay-containers/a7f3c9deb0656f8de1d107e7ddff2d3c3c279c11c1635f233a0bffb16051fb2c/userdata/shm: device or resource busy

Since podman is volume mounting in the graphroot, it will add a flag to
/run/.containerenv to tell podman inside of container whether to reset storage or not.

Since the inner podman is running inside of the container, no reason to assume this is a fresh reboot, so if "container" environment variable is set then skip
reset of storage.

Also added tests to make sure /run/.containerenv is runnig correctly.

Fixes: https://github.com/containers/podman/issues/9191

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2021-02-16 14:18:53 -05:00
..
common
define Display correct value for unlimited ulimit 2021-02-10 14:17:58 -06:00
driver Exorcise Driver code from libpod/define 2021-01-12 11:48:53 -05:00
events Enable whitespace linter 2021-02-11 23:01:56 +01:00
image Merge pull request #9341 from vrothberg/layer-tree-errors 2021-02-12 13:32:00 -05:00
layers
linkmode Add podman static build 2020-05-11 13:11:07 +02:00
lock Remove excessive error wrapping 2020-10-05 15:30:37 -07:00
logs re-open container log files 2020-12-23 14:04:32 -06:00
network Enable whitespace linter 2021-02-11 23:01:56 +01:00
plugin Enable golint linter 2021-02-11 23:01:49 +01:00
shutdown Ensure shutdown handler access is syncronized 2021-01-25 15:44:42 -05:00
boltdb_state.go Enable whitespace linter 2021-02-11 23:01:56 +01:00
boltdb_state_internal.go Initial implementation of volume plugins 2021-01-14 15:35:33 -05:00
boltdb_state_linux.go Spelling 2020-12-22 13:34:31 -05:00
boltdb_state_unsupported.go
common_test.go Switch all references to github.com/containers/libpod -> podman 2020-07-28 08:23:45 -04:00
container.go Enable whitespace linter 2021-02-11 23:01:56 +01:00
container_api.go Fix per review request 2021-02-04 18:30:07 +01:00
container_commit.go Switch all references to github.com/containers/libpod -> podman 2020-07-28 08:23:45 -04:00
container_config.go Implement Secrets 2021-02-09 09:13:21 -05:00
container_exec.go Enable golint linter 2021-02-11 23:01:49 +01:00
container_graph.go Switch all references to github.com/containers/libpod -> podman 2020-07-28 08:23:45 -04:00
container_graph_test.go Switch all references to github.com/containers/libpod -> podman 2020-07-28 08:23:45 -04:00
container_inspect.go Enable whitespace linter 2021-02-11 23:01:56 +01:00
container_internal.go Enable golint linter 2021-02-11 23:01:49 +01:00
container_internal_linux.go Do not reset storage when running inside of a container 2021-02-16 14:18:53 -05:00
container_internal_linux_test.go Make an entry in /etc/group when we modify /etc/passwd 2020-09-10 13:02:31 -04:00
container_internal_test.go Refactor container config 2020-07-23 10:18:14 -04:00
container_internal_unsupported.go Implement pod-network-reload 2020-12-07 19:26:23 +01:00
container_linux.go
container_log.go Fix podman logs read partial log lines 2021-01-07 00:04:38 +01:00
container_log_linux.go Fix Podman logs reading journald 2020-10-02 10:05:19 -04:00
container_log_unsupported.go Switch all references to github.com/containers/libpod -> podman 2020-07-28 08:23:45 -04:00
container_path_resolution.go Enable whitespace linter 2021-02-11 23:01:56 +01:00
container_top_linux.go Remove varlink support from Podman 2020-11-26 16:50:42 -05:00
container_top_unsupported.go Spelling 2020-12-22 13:34:31 -05:00
container_unsupported.go
container_validate.go Spelling 2020-12-22 13:34:31 -05:00
diff.go fix podman container exists and diff for storage containers 2020-10-15 09:51:15 -04:00
events.go add network connect|disconnect compat endpoints 2020-11-19 08:16:19 -06:00
healthcheck.go Enable golint linter 2021-02-11 23:01:49 +01:00
healthcheck_linux.go Set PATH env in systemd timer. 2020-11-23 10:26:02 -08:00
healthcheck_unsupported.go Switch all references to github.com/containers/libpod -> podman 2020-07-28 08:23:45 -04:00
in_memory_state.go Fix problems reported by staticcheck 2021-01-12 16:11:09 +01:00
info.go Enable golint linter 2021-02-11 23:01:49 +01:00
kube.go generate kube: support --privileged 2021-02-09 17:40:35 +01:00
mounts_linux.go
networking_linux.go Enable golint linter 2021-02-11 23:01:49 +01:00
networking_unsupported.go Implement pod-network-reload 2020-12-07 19:26:23 +01:00
oci.go Handle podman exec capabilities correctly 2021-01-07 05:53:50 -05:00
oci_attach_linux.go oci: use /proc/self/fd/FD to open unix socket 2021-01-12 10:38:32 +01:00
oci_attach_unsupported.go Force Attach() to send a SIGWINCH and redraw 2020-09-10 17:54:47 -04:00
oci_conmon.go podman: add new cgroup mode split 2020-06-25 17:16:12 +02:00
oci_conmon_exec_linux.go remote exec: write conmon error on hijacked connection 2021-01-27 09:58:27 +01:00
oci_conmon_linux.go Enable whitespace linter 2021-02-11 23:01:56 +01:00
oci_conmon_unsupported.go Add global options --runtime-flags 2020-09-04 15:04:36 -04:00
oci_missing.go Send HTTP Hijack headers after successful attach 2020-08-27 12:50:22 -04:00
oci_util.go Enable whitespace linter 2021-02-11 23:01:56 +01:00
options.go Enable whitespace linter 2021-02-11 23:01:56 +01:00
pod.go Allow pods to use --net=none 2021-02-02 10:35:23 -05:00
pod_api.go Fix podman pod inspect show wrong MAC string 2020-11-18 18:06:06 +08:00
pod_internal.go Switch all references to github.com/containers/libpod -> podman 2020-07-28 08:23:45 -04:00
pod_status.go Add a Degraded state to pods 2020-10-21 13:31:40 -04:00
pod_top_linux.go Spelling 2020-12-22 13:34:31 -05:00
pod_top_unsupported.go Switch all references to github.com/containers/libpod -> podman 2020-07-28 08:23:45 -04:00
reset.go Enable whitespace linter 2021-02-11 23:01:56 +01:00
rootless_cni_linux.go Add support for rootless network-aliases 2021-01-27 20:58:03 +01:00
runtime.go Do not reset storage when running inside of a container 2021-02-16 14:18:53 -05:00
runtime_cstorage.go Drop default log-level from error to warn 2020-12-03 06:28:09 -05:00
runtime_ctr.go Enable whitespace linter 2021-02-11 23:01:56 +01:00
runtime_img.go podman build: pass runtime to buildah 2021-02-16 13:01:56 +01:00
runtime_img_test.go Enable whitespace linter 2021-02-11 23:01:56 +01:00
runtime_migrate.go Use Libpod tmpdir for pause path 2020-12-02 14:18:37 -05:00
runtime_migrate_unsupported.go Use Libpod tmpdir for pause path 2020-12-02 14:18:37 -05:00
runtime_pod.go Switch all references to github.com/containers/libpod -> podman 2020-07-28 08:23:45 -04:00
runtime_pod_infra_linux.go Fix panic in pod creation 2021-02-16 06:29:49 -06:00
runtime_pod_linux.go Drop default log-level from error to warn 2020-12-03 06:28:09 -05:00
runtime_pod_unsupported.go Switch all references to github.com/containers/libpod -> podman 2020-07-28 08:23:45 -04:00
runtime_renumber.go Switch all references to github.com/containers/libpod -> podman 2020-07-28 08:23:45 -04:00
runtime_volume.go Rework pruning to report reclaimed space 2020-12-30 19:57:35 -06:00
runtime_volume_linux.go Initial implementation of volume plugins 2021-01-14 15:35:33 -05:00
runtime_volume_unsupported.go Switch all references to github.com/containers/libpod -> podman 2020-07-28 08:23:45 -04:00
state.go Add support for network connect / disconnect to DB 2020-11-11 16:37:54 -05:00
state_test.go Spelling 2020-12-22 13:34:31 -05:00
stats.go container cgroup path 2020-12-07 15:16:20 +01:00
stats_unsupported.go Switch all references to github.com/containers/libpod -> podman 2020-07-28 08:23:45 -04:00
storage.go Switch all references to github.com/containers/libpod -> podman 2020-07-28 08:23:45 -04:00
util.go remote exec: write conmon error on hijacked connection 2021-01-27 09:58:27 +01:00
util_linux.go Fix mismatch between log messages and behavior of libpod.LabelVolumePath. 2020-09-13 23:24:15 -04:00
util_linux_test.go Fix mismatch between log messages and behavior of libpod.LabelVolumePath. 2020-09-13 23:24:15 -04:00
util_test.go Switch all references to github.com/containers/libpod -> podman 2020-07-28 08:23:45 -04:00
util_unsupported.go Switch all references to github.com/containers/libpod -> podman 2020-07-28 08:23:45 -04:00
volume.go Rewrite copy-up to use buildah Copier 2021-02-10 14:21:37 -05:00
volume_inspect.go Initial implementation of volume plugins 2021-01-14 15:35:33 -05:00
volume_internal.go Initial implementation of volume plugins 2021-01-14 15:35:33 -05:00
volume_internal_linux.go Enable golint linter 2021-02-11 23:01:49 +01:00
volume_internal_unsupported.go Switch all references to github.com/containers/libpod -> podman 2020-07-28 08:23:45 -04:00