Skip to content

Instantly share code, notes, and snippets.

@gbraad
Last active August 30, 2017 07:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gbraad/514a5bb99781961694e7615ee145af83 to your computer and use it in GitHub Desktop.
Save gbraad/514a5bb99781961694e7615ee145af83 to your computer and use it in GitHub Desktop.
Exploring MobyLinuxVM

Exploring MobyLinuxVM (or Docker host)

Use privileged Alpine chroot

$ docker run --net=host --ipc=host --uts=host --pid=host -it --security-opt=seccomp=unconfined --privileged --rm -v /:/host alpine /bin/sh
$ chroot /host

Use privileged nsenter

FROM alpine
MAINTAINER Gerard Braad <me@gbraad.nl>
RUN apk update && \
    apk add util-linux && \
    rm -rf /var/cache/apk/*
ENTRYPOINT ["nsenter", "--target", "1", "--mount", "--uts", "--ipc", "--net", "--pid"]
PS> docker build -t hostenter .
PS> docker run -it --privileged --pid=host hostenter /bin/sh   # gbraad/hostenter => http://github.com/gbraad/hostenter
···
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment