guilhem/runinhost

By guilhem

Updated about 5 years ago

Image

50

runInHost

MicroBadger Size

Run a command on your host from a container.

Examples

Docker
$ docker run --privileged --pid=host guilhem/runinhost ls /boot/grub/
fonts
gfxblacklist.txt
grub.cfg
grubenv
unicode.pf2
x86_64-efi
Kubernetes
apiVersion: batch/v1
kind: Job
metadata:
  name: hello-host
spec:
  template:
    spec:
      hostPID: true # Facilitate entering the host mount namespace via init
      containers:
      - name: runInHost
        image: guilhem/runinhost
        imagePullPolicy: IfNotPresent
        securityContext:
          privileged: true # Give permission to nsenter /proc/1/ns/mnt
        args:
        - test
        - -f
        - /var/run/reboot-required
  backoffLimit: 4

If you are using the podSecurityPolicies you can use manifests and kustomize in ./manifests.

Under The hood

runInHost is a simple wrapper that call nsenter to execute command on host.

Docker Pull Command

docker pull guilhem/runinhost