9 Commits
Author SHA1 Message Date
Jonathan Boulle 9685f37575 *: adjust copyright header
Inspired by a similar change in the Kubernetes project [1], this changes
the copyright header to the more generic "The rkt Authors" rather than
"CoreOS, Inc.", which is only sometimes correct.

https://github.com/GoogleCloudPlatform/kubernetes/commit/6b3a6e6b983f967c88d14d26542ec6e30c49ebd3
2015-05-03 14:29:15 -07:00
Vito Caputo f445d37892 rkt/enter: use pod.getPID() to get container's pid race-free
- Fixup pod.getPID() to cover race between xToRun() and stage1 getting
  around to writing the pid file.

- Rework `rkt enter` to retrieve the pid in rkt/stage0 and supply it to
  stage1 enter.

- Rework stage1 enter to consume pid from argv instead of opening it
  itself, so as to not have to duplicate the same race coverage.

- Some stage1 enter code cleanups thrown in for good measure, particularly
  around the argv forwarding copy which started simple had become unwieldy.
2015-04-24 17:29:30 -07:00
Iago López Galeiras 83a4d69db9 rkt: use entrypoint annotation to resolve enter
d12615f hard-coded the enter binary to accomodate overlayfs, this goes
back to using the entrypoint annotation.
2015-04-16 20:22:14 +02:00
Jonathan Boulle 79753c9b19 *: rocket -> rkt 2015-03-31 16:31:21 -07:00
Jonathan Boulle 3fd0303076 *: global containers -> pods rename 2015-03-31 15:55:06 -07:00
Iago López Galeiras d12615f462 rkt: fix enter
When using overlay, the stage1 filesystem is mounted in a separate mount
namespace, rkt can't access the enter binary.

We now get the enter binary from the tree cache, using the stage1 image
the user specified when preparing/running the container.
2015-03-24 10:12:13 +01:00
Jonathan Boulle 72395d1ffa *: vendor appc spec
Take two at getting the spec vendored into Rocket with Godep.
Since actool is used during the construction of the stage1.aci, it
really needs to be vendored too to prevent any unexpected divergence
between whatever version the user happens to have in their PATH. Thus,
we introduce a silly dummy package (stage1/dummy.go) to coerce Godep
into vendoring actool. This also requires a slight rearrangement of the
appc repo, moving some functionality from actool itself into the aci
package.
2015-02-05 14:36:40 +01:00
Vito Caputo bae52e60ae *: switch stage1 to aci image format
One may now specify an alternative stage1 in a style like run and fetch:
rkt run --stage1-image foo.com/rocket/stage1 app

--stage1-image defaults to "stage1.aci" within the same directory as the rkt
binary.  This is discovered at runtime via "/proc/self/exe"; as long as the rkt
executable and stage1.aci share a directory it should "just work" regardless of
the directory's location and where rkt is executed from.
2015-01-30 10:51:15 -08:00
Vito Caputo 265731eb58 rkt enter: implement entering app namespaces
This introduces a stage1 /enter entrypoint which expects:
 * the CWD to be the container root (/var/lib/rkt/containers/$cuuid)
 * argv[1] to be the shorthash app imageid to enter
 * argv[2] to be the command for executing via execvp
 * argv[3+] any additional arguments for the command

An example manual /enter shell invocation would be:
 cd /var/lib/rkt/containers/9793daa1-e064-49a6-9d52-261a992bddd8 && \
 ./enter sha512-9e6a3ab113ed783c1ffdcbbaa7d16f3b /bin/bash -i

"rkt enter" effectively does this after some simple argv parsing/checks and
verification of the container being presently active.

What must occur within /enter is stage1-implementation specific, hence its
inclusion within the stage1 rootfs.

The /enter implemented here consists of a statically-linked minimal C
program which:
   * reads the container's PID from ./pid
   * enters the namespaces of the container's PID 1
   * forks to realize CLONE_NEWPID
   * execs /diagexec in the child using the argv[] /enter received
   * waits for the child to exit

The UX side looks like:
 rkt enter [--imageid IMAGEID] UUID [CMD [ARGS ...]]

 If no IMAGEID is specified, and the container is a singleton then its lone
 app is entered.  Otherwise a list of apps and their ids is printed and the
 user must specify which app to enter in a separate invocation via --imageid.

 If no cmd is specified, /bin/bash is assumed.

 Examples:

  Multiple images, ambiguous enter:
   $ rkt enter 7324849e-80b7-4874-a14b-79de35291485
   Container "7324849e-80b7-4874-a14b-79de35291485" contains multiple apps:
           sha512-8a4a96dac7216ca311962d19ffa00b6c: pauser
           sha512-2893e1a4714bea23ee9f21c7dd6561a4: sleeper
   Unable to determine image id: specify app using "rkt enter --imageid ..."

  Multiple images, specified "pauser":
   $ rkt enter --imageid sha512-8a4a96dac7216ca311962d19ffa00b6c 7324849e-80b7-4874-a14b-79de35291485
   No command specified, assuming "/bin/bash"
   bash-4.3#

  Multiple images, enter "pauser", run /pause:
   $ rkt enter --imageid sha512-8a4a96dac7216ca311962d19ffa00b6c 7324849e-80b7-4874-a14b-79de35291485 /pause
   paused...^C
   $

  Single image:
   $ rkt enter 98d688dc-5665-496c-8556-f553020ccd57
   No command specified, assuming "/bin/bash"
   bash-4.3#
2015-01-09 17:42:39 -08:00