Commit Graph

195 Commits

Author SHA1 Message Date
Rolf Neugebauer
7cf2c5abf7 pkg: Update all packages to the latest linuxkit/alpine
Signed-off-by: Rolf Neugebauer <rolf.neugebauer@docker.com>
2018-01-25 13:42:33 +00:00
Justin Cormack
4b9ffadb2e Add support for runtime containerd namespace configuration
Signed-off-by: Justin Cormack <justin.cormack@docker.com>
2018-01-18 12:40:56 +00:00
Ian Campbell
a811110ad8 Bump packages to new alpine w/ containerd v1.0.1
Signed-off-by: Ian Campbell <ijc@docker.com>
2018-01-18 10:59:41 +00:00
Ian Campbell
a4230b74aa init: print integer with %d not %s
go_vet (via https://goreportcard.com/report/github.com/linuxkit/linuxkit)
reported:

    error: arg resource for printf verb %s of wrong type: int (vet)

Signed-off-by: Ian Campbell <ijc@docker.com>
2018-01-15 17:24:36 +00:00
Ian Campbell
913e6420ba Bump packages to new alpine w/ containerd v1.0.1-rc.0
Signed-off-by: Ian Campbell <ijc@docker.com>
2018-01-12 10:51:01 +00:00
Ian Campbell
794ea7ed72 Make runtime.mounts[].destination relative to container rootfs
This is similar to ae64ab6b82 from #2849 which
did the same for runtime.mkdir.

This makes it possible to specify both host (absolute) or container (relative)
paths.

Signed-off-by: Ian Campbell <ijc@docker.com>
2018-01-11 12:58:09 +00:00
Justin Cormack
ae64ab6b82 Make relative paths in runtime mkdir be relative to container rootfs
Currently all paths were treated as absolute paths.

Signed-off-by: Justin Cormack <justin.cormack@docker.com>
2018-01-10 14:58:49 +00:00
Justin Cormack
a4a332f39a Use logrus not log for logging consistently
Signed-off-by: Justin Cormack <justin.cormack@docker.com>
2018-01-10 14:28:50 +00:00
Stephen J Day
fbbab9eafd
pkg/init/cmd/service: plumb containerd namespace
This PR correctly plumbs a single context to propagate the containerd
namespace to the necessary commands. Services launched with containerd
after this change will now be in a default namespace of
`services.linuxkit`.

A top-level flag is added to the service command,
`--containerd-namespace` which can be used to change, if needed.

Signed-off-by: Stephen J Day <stephen.day@docker.com>
2018-01-05 14:45:19 -08:00
Tobias Klauser
642c6f23ac Use pure Go unix.Reboot function in rc.init
Use unix.Reboot from golang.org/x/sys/unix for poweroff and reboot
instead of relying on external commands.

Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2018-01-04 13:16:28 +01:00
Rolf Neugebauer
fa51c915ba pkg: Update all package to the alpine:3.7 base
Signed-off-by: Rolf Neugebauer <rolf.neugebauer@docker.com>
2017-12-08 16:25:13 +00:00
Ian Campbell
2561827100 Bump packages to new alpine w/ containerd v1.0.0
Signed-off-by: Ian Campbell <ijc@docker.com>
2017-12-05 09:55:32 +00:00
Ian Campbell
28e22e40bb Bump packages to new alpine w/ containerd v1.0.0-rc.0
Minor updates due to renamings in containerd.

Signed-off-by: Ian Campbell <ijc@docker.com>
2017-12-01 13:36:16 +00:00
Justin Cormack
6cb919b489 Add support for creating cgroups in runtime section
Implements https://github.com/moby/tool/pull/181

Design for things like Kubernetes setup that requires some cgroups to
exist when the service starts but it is not running in these, other
services are, so there would be a race if they are not created in each.

Essentially it is just a sugared `mkdir` in all the cgroup dirs.

Signed-off-by: Justin Cormack <justin.cormack@docker.com>
2017-11-17 14:12:41 +00:00
Ian Campbell
61ca751840 Bump packages to new alpine w/ containerd v1.0.0-beta.3
Signed-off-by: Ian Campbell <ijc@docker.com>
2017-11-09 10:16:33 +00:00
Ian Campbell
6c7b1c0251 Bump all packages to newest alpine.
Signed-off-by: Ian Campbell <ijc@docker.com>
2017-10-24 10:11:24 +01:00
Ian Campbell
a9b03c3f95 Update all users of go-compile.sh to new alpine (go1.9)
Signed-off-by: Ian Campbell <ijc@docker.com>
2017-10-12 16:47:35 +01:00
Ian Campbell
aba82533a0 Update go system components to new alpine (go1.9)
Signed-off-by: Ian Campbell <ijc@docker.com>
2017-10-12 16:45:01 +01:00
Ian Campbell
aeed5f6b40 init,containerd: bump to new alpine with v1.0.0-beta.2.
Signed-off-by: Ian Campbell <ijc@docker.com>
2017-10-12 12:57:08 +01:00
Ian Campbell
a237b51511 Bump alpine base across the board.
By running:

    ./scripts/update-component-sha.sh --image linuxkit/alpine ad35b6ddbc70faa07e59a9d7dee7707c08122e8d

Signed-off-by: Ian Campbell <ijc@docker.com>
2017-10-10 09:55:45 +01:00
Ian Campbell
fc3e659f0e Convert all of pkg/* to linuxkit pkg build
This was done with the following "script":

    git rm pkg/{auditd,binfmt,init}/Makefile
    sed -e 's/IMAGE=/image: /g' -i pkg/*/Makefile
    sed -e 's/NETWORK=1/network: true/g' -i pkg/*/Makefile
    sed -e 's/ARCHES=x86_64/arches:\n  - amd64/g' -i pkg/*/Makefile
    sed -e '/DEPS:\?=/d' -i pkg/*/Makefile
    sed -e '/ARCHES=SKIP/d' -i pkg/node_exporter/Makefile
    sed -e 's/include \.\.\/package.mk//g' -i pkg/*/Makefile
    sed -e '/^$/d' -i pkg/*/Makefile
    git mv pkg/node_exporter/Makefile pkg/node_exporter/build.yml-skip
    for i in pkg/*/Makefile ; do git mv $i ${i%Makefile}build.yml ; done

and manual update of pkg/Makefile.

Signed-off-by: Ian Campbell <ijc@docker.com>
2017-10-09 16:20:26 +01:00
Ian Campbell
ba60937754 Implement package build, push and show-tag in linuxkit tool
This implements the proposal in #2564 and converts a handful of representative
or especially interesting (from a build PoV) packages to use it.

For now those pkg/* affected get a stub-`Makefile`, once all packages are
converted then `pkg/Makefile` can be adjusted and those stubs can be removed.

For now only `pkg/package.mk`'s functionality is implemented. In particular:

- `push-manifest.sh` remains a separate script, to enable calling it on systems
  with just the LinuxKit tools installed arrange to install it under a less
  generic name.
- `kernel` and `tools/alpine` do not use `pkg/package.mk` and those cases are
  not yet fully considered/covered.

I have updated the documentation assuming that the existing uses of
`pkg/package.mk` will be removed quite soon in a follow up PR rather than
trying to document the situation which results after just this commit.

Due to `cmd/linuxkit` now gaining a library the build needs adjusting slightly to
allow both `make bin/linuxkit` and `go build` to work.

`go vet` has forced me to write some rather asinine comments for things that
are rather obvious from the name.

Signed-off-by: Ian Campbell <ijc@docker.com>
2017-10-06 12:59:25 +01:00
Ian Campbell
09c89a923b Bump init and containerd package to v1.0.0-beta.1
golint on pkg/init now complains:

    golint...
    ./init.go:199:2: redundant if ...; err != nil check, just return error instead.

Resulting in a change which doesn't seem like an improvement to me.

Signed-off-by: Ian Campbell <ijc@docker.com>
2017-09-25 13:39:21 +01:00
Justin Cormack
042cd763fe Add vendoring for rc.init
Signed-off-by: Justin Cormack <justin.cormack@docker.com>
2017-09-18 11:46:00 -07:00
Justin Cormack
bcfb760a1d Convert rc.init and rc.shutdown to Go
This removes more shell scripts to improve maintainability.

This now also works correctly in userspace, so it can be used for
running LinuxKit images in Docker and other such use cases.

It is a literal conversion of the shell scripts with a few small
tweaks.

Signed-off-by: Justin Cormack <justin.cormack@docker.com>
2017-09-18 11:45:59 -07:00
David Scott
9c35dbaac2 service: log stdout and stderr to separate files
Previously we would pass the path `/var/log/service.log` for both
stdout and stderr to containerd. containerd would construct a dict
with the paths as keys[1] and, due to the duplicate key, would only
open one of the files and start one `io.Copy` instance. Writes to
the other stream would be buffered by the pipe connected to
containerd-shim and would eventually block.

If we modified containerd to open the file twice and start 2
`io.Copy` instances, we would end up with the two streams interleaved
together. It seems cleaner to keep the streams separate; therefore
this patch logs stdout to `/var/log/service.out.log` and stderr to
`/var/log/service.err.log`.

[1]
49437711c3/linux/shim/io.go (L51)

Signed-off-by: David Scott <dave.scott@docker.com>
2017-09-14 11:15:04 +01:00
Ian Campbell
6cbc3ed518 Bump init+containerd to new alpine base with containerd beta.0
Signed-off-by: Ian Campbell <ijc@docker.com>
2017-09-07 18:31:57 +01:00
Ian Campbell
b0b08e18a2 Bump init and containerd packages to v1.0.0-alpha6
Signed-off-by: Ian Campbell <ijc@docker.com>
2017-08-29 01:02:20 +01:00
Justin Cormack
5773dfd844 Cleanup cleanup code
Only remove main mount at rootfs, as we do not really know
about the state of the rest.

Signed-off-by: Justin Cormack <justin.cormack@docker.com>
2017-08-23 16:40:03 +01:00
Justin Cormack
49cf74f4f6 Switch to having the moby tool specify how to do mounts
This removes all the code that had knowledge of how to do read only
and read write container mounts, and just uses the runtime config.

Signed-off-by: Justin Cormack <justin.cormack@docker.com>
2017-08-23 16:40:03 +01:00
Justin Cormack
c677b391fc Add support for mount in runtime config
This could be used in LinuxKit now, as there are some examples, eg
https://github.com/linuxkit/linuxkit/blob/master/blueprints/docker-for-mac/base.yml#L33
which are creating containers to do a mount.

The main reason though is to in future change the ad hoc code that generates
overlay mounts for writeable containers with a runtime config which does
the same thing; this code needs to create both tmpfs and overlay mounts.

See https://github.com/moby/tool/pull/145

Signed-off-by: Justin Cormack <justin.cormack@docker.com>
2017-08-23 16:40:03 +01:00
David Scott
da86df1ad6 init: add /etc/ssl/certs as required by the metadata package
The metadata package has binds
  - /dev
  - /var
  - /sys
  - /etc/resolv.conf
  - /etc/ssl/certs

but unfortunately `/etc/ssl/certs` doesn't exist and this causes the
following commands:

  cd blueprints/docker-for-mac # easy example
  moby build -name docker-for-mac base.yml docker-17.06-ce.yml
  linuxkit run hyperkit -networking=vpnkit -vsock-ports=2376 -disk size=500M docker-for-mac

to produce the following error on the VM console:

  container_linux.go:265: starting container process caused "process_linux.go:348: container init caused \"rootfs_linux.go:57: mounting \\\"/etc/ssl/certs\\\" to rootfs \\\"/containers/onboot/000-metadata/rootfs\\\" at \\\"/etc/ssl/certs\\\" caused \\\"stat /etc/ssl/certs: no such file or directory\\\"\""
  2017/08/21 16:39:40 Error creating 000-metadata: exit status 1

This patch creates /etc/ssl/certs in the `init` package. The metadata package
will now say things like

  2017/08/21 16:44:39 No metadata/userdata found. Bye

Signed-off-by: David Scott <dave.scott@docker.com>
2017-08-21 17:46:29 +01:00
Justin Cormack
90f905a799 Move containerd clone to tools/alpine
As discussed before, as we use this in three places, cloning in
base makes more sense.

Update base image.

Signed-off-by: Justin Cormack <justin.cormack@docker.com>
2017-08-21 15:16:09 +01:00
Justin Cormack
c82b2fe13e Add vendoring for netlink
Signed-off-by: Justin Cormack <justin.cormack@docker.com>
2017-08-17 12:10:28 +01:00
Justin Cormack
0c81ce19e8 Add a runtime config
This adds support for a runtime configuration file that can do:
- `mkdir` to make a directory at runtime, eg in `/var` or `/tmp`, to avoid workarounds
- `interface` that can create network interfaces in a container or move them
- `bindNS` that can bind mount namespaces of an `onboot` container to a file so a service can be started in that namespace.

It merges the `service` and `onboot` tools (in `init`) to avoid duplication. This also saves some size for
eg LCOW which did not use the `onboot` code in `runc`.

Signed-off-by: Justin Cormack <justin.cormack@docker.com>
2017-08-17 12:10:28 +01:00
Justin Cormack
df16f6fb9e Move init command into a subdirectory
Signed-off-by: Justin Cormack <justin.cormack@docker.com>
2017-08-17 12:10:28 +01:00
Justin Cormack
76bb43027b Do an extra chmod after chown
Chown clears suid bits even for root on Linux.

Also move a few functions to x/sys/unix from syscall, to be
more arm64 friendly.

Signed-off-by: Justin Cormack <justin.cormack@docker.com>
2017-08-07 14:49:43 +01:00
Rolf Neugebauer
e44783fea1 pkg: Update alpine base for all packages
Signed-off-by: Rolf Neugebauer <rolf.neugebauer@docker.com>
2017-08-03 17:46:10 +01:00
Justin Cormack
737fbcb3b6 Add standard directories in /var
Signed-off-by: Justin Cormack <justin.cormack@docker.com>
2017-07-31 21:09:48 +01:00
Justin Cormack
2c20ee2f8a Use a tmpfs for /var
Previously we were cheating and remounting /var `rw` but this does not
work if the filesystem is really read only. Nount a tmpfs, which may
be overmounted later by a persistent filesystem.

Signed-off-by: Justin Cormack <justin.cormack@docker.com>
2017-07-31 15:25:54 +01:00
Justin Cormack
cb2ca4ef66 Switch runc and containerd startup to be entirely Go
At present they use a small shared function called "prepare"
that does the read-write remounts, that I will switch to doing overlay
mounts soon.

Signed-off-by: Justin Cormack <justin.cormack@docker.com>
2017-07-26 16:32:09 +01:00
Justin Cormack
a81d2deb61 Do not try to change /etc/resolv.conf
The filesystem is supposed to be immutable, so do not try to make
a symlink; new versions of moby tool should add one anyway. But
try to make the directory a symlink points to, assuming that it
will be on a writeable filesystem.

fix #1920
see also #2288

Signed-off-by: Justin Cormack <justin.cormack@docker.com>
2017-07-25 15:30:24 +01:00
Justin Cormack
6307ec9cd1 Rewrite /init in Go
This uses a more memory efficient copy, and gets us closer to
not having a shell in the base system if not required.

Signed-off-by: Justin Cormack <justin.cormack@docker.com>
2017-07-24 15:01:58 +01:00
Justin Cormack
fe8f979da5 Add support for shutdown scripts
These can be added by other packages if they need to do something on
clean shutdown.

Crash only software can ignore this.

Signed-off-by: Justin Cormack <justin.cormack@docker.com>
2017-07-18 11:54:58 +01:00
Ian Campbell
fc20fb8a2c pkg/init: Do not run inits in the background
We want them to run in sequence. For example we want mounts to be done (done by
`pkg/runc/etc/init.d/010-onboot`) before we start services (done by
`pkg/containerd/etc/init.d/020-containerd`). This was most likely introduced by
28b4245b12 ("Move onboot startup script to runc package").

None of the initscripts in pkg/* block, but some in projects (selinux and
logging, not updated here) do.

Signed-off-by: Ian Campbell <ijc@docker.com>
2017-07-15 12:39:12 +01:00
Justin Cormack
28b4245b12 Move onboot startup script to runc package
As this does not use containerd at all, this means you can run very
minimal setups with just `runc` if you use no services, for example
most of our tests do not actually use services, or if you have other
similar very minimal use cases.

Move ulimit setup to `init` which makes more sense.

Signed-off-by: Justin Cormack <justin.cormack@docker.com>
2017-07-14 11:04:35 +01:00
Justin Cormack
f43e1cbf27 Move containerd init file from init package to containerd package
Otherwise it gets out of sync, and it makes little sense it being in
`init` now anyway.

Signed-off-by: Justin Cormack <justin.cormack@docker.com>
2017-07-03 13:42:00 +01:00
Rolf Neugebauer
699a864302 pkg: Update to new Alpine base
Signed-off-by: Rolf Neugebauer <rolf.neugebauer@docker.com>
2017-07-01 18:11:45 +01:00
Dave Tucker
5a225b9dc5 Makefile: Fix bug where network was not disabled
This commit moves the include statement to the bottom of the file to
ensure that all variables are set before conditionals are evaluated.

I also changed the ifndef NETWORK to ifdef NETWORK as the former was
incorrect. We want `NET_OPTS="--network=none"` in cases where NETWORK is
not defined.

Fixes: #2134

Signed-off-by: Dave Tucker <dt@docker.com>
2017-06-30 11:55:08 +01:00
Rolf Neugebauer
cab27698f4 pkg: Update all packages to the new alpine base
In a subsequent commit, all YAML files will be updated with
new package hashes since all packages needed rebuild due to
build system changes in commit adae27b8d1 ("Simplify
Makefiles for Packages"). So, we might as well bring all
packages up to the latest alpine base package.

Signed-off-by: Rolf Neugebauer <rolf.neugebauer@docker.com>
2017-06-27 17:43:57 +01:00
Rolf Neugebauer
d65bb86c37 Merge pull request #2080 from dave-tucker/pkg-mk
Simplify Makefiles for Packages
2017-06-22 13:35:43 +01:00
Dave Tucker
adae27b8d1 Simplify Makefiles for Packages
These now inherit from a top-level package.mk
Options like use of the network can be enabled on a per package basis
This removes a lot of duplicate code and make the maintenace of these
Makefiles much easier

Signed-off-by: Dave Tucker <dt@docker.com>
2017-06-22 12:40:03 +01:00
Sebastiaan van Stijn
4e1c91fc6e
Update ASCII whale
The logo changed, and no longer has waves,
so removing them from the ASCII whale as well

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2017-06-20 23:22:23 -07:00
Ian Campbell
d51784adc0 Allow /etc/init.d/010-containerd to exit when complete
Don't think there is a need for it to remain and it drops an unnecessary
process.

Signed-off-by: Ian Campbell <ian.campbell@docker.com>
2017-06-16 11:49:52 +01:00
Ian Campbell
5833d1b6bc init: replace ctr with a custom client using the containerd client library
Currently it supports only `service start <SERVICE>`, but it could grow e.g.
`stop`, `exec` etc in the future (although you can still use `ctr` for those).

In order to be able to use go-compile.sh the containerd build needs to move
from /root/go to /go as the GOPATH.

The vendoring situation is not ideal, but since this tool wants to be an exact
match for the containerd it seems tollerable to reuse its vendoring.

Signed-off-by: Ian Campbell <ian.campbell@docker.com>
2017-06-16 11:48:53 +01:00
Rolf Neugebauer
d48715cd8c Merge pull request #2037 from tych0/usermode-helper
add a static usermode helper
2017-06-15 11:26:41 -07:00
Tycho Andersen
a4e0a594b1 add a static usermode helper
The binary is used in tandem with CONFIG_STATIC_USERMODEHELPER=y in 4.11+,
see the big comment in the binary for the current whitelist of binaries.

Signed-off-by: Tycho Andersen <tycho@docker.com>
2017-06-15 10:39:52 -07:00
Rolf Neugebauer
4e4efcd985 pkg: Add support for cold-plugged devices to init
mdev only supports hot-plug, ie devices which are added
after the kernel booted. For cold-plugged devices, ie devices
present when the kernel boots, we need to modprobe the drivers
differently. The additions to rc.init does just that.

Signed-off-by: Rolf Neugebauer <rolf.neugebauer@docker.com>
2017-06-13 15:57:24 -07:00
Avi Deitcher
f2cece3c61 Fix perms on /etc/init.d/000-issue
Signed-off-by: Avi Deitcher <avi@deitcher.net>
2017-06-08 18:49:29 +03:00
Avi Deitcher
a7c577468d Remove all tty init from init
Signed-off-by: Avi Deitcher <avi@deitcher.net>
2017-06-07 15:43:40 +03:00
Justin Cormack
08e211df44 Use the sinit conventions for init
This should make it easier to switch out `init` for other versions,
although the `getty` config still needs to be removed.

- use `/bin/rc.init` for start
- use `rc.shutdown` for stop
- make `rc.init` run other code.
- merge `containers` and `containerd` startup code

Signed-off-by: Justin Cormack <justin.cormack@docker.com>
2017-05-30 14:14:34 +01:00
Rolf Neugebauer
7915cae6bd pkg: Update the Alpine base for some of the packages
The remaining packages will be updated with subsequent commits
to also include the config label.

Signed-off-by: Rolf Neugebauer <rolf.neugebauer@docker.com>
2017-05-26 15:50:54 +01:00
Riyaz Faizullabhoy
05f1c282d5 Update images that have been newly setup for signing to use content trust on push
Signed-off-by: Riyaz Faizullabhoy <riyaz.faizullabhoy@docker.com>
2017-05-25 11:06:08 -07:00
Rolf Neugebauer
72c88872e6 pkg: Roll the init package from linuxkit/alpine
We only need the alpine-baselayout packe to run init. This also
removes the sha256 import from alpine:edge.

This also reduces the size of the init package by more than
50% to just 1.5MB.

Also make the HUB org/registry build time configurable.

Signed-off-by: Rolf Neugebauer <rolf.neugebauer@docker.com>
2017-05-18 18:55:22 +01:00
Justin Cormack
6a5f8099a4 Remove extra files from init
fix #1807

Signed-off-by: Justin Cormack <justin.cormack@docker.com>
2017-05-12 15:36:13 +01:00
Justin Cormack
589d4bff58 Remove some old .gitignore files
Signed-off-by: Justin Cormack <justin.cormack@docker.com>
2017-05-12 15:25:59 +01:00
Justin Cormack
515b25d518 Do not make directories
These should now be in the image.

Signed-off-by: Justin Cormack <justin.cormack@docker.com>
2017-05-10 11:00:35 +01:00
Rolf Neugebauer
662ed3ad1f pkg: Remove c-compile from init
There is no need for start-stop-daemon since this package
is using containerd. Remove it and update the init
package to alpine:edge

Also use the git tree hash for the package hash while at it.

Signed-off-by: Rolf Neugebauer <rolf.neugebauer@docker.com>
2017-05-08 16:46:47 +01:00
Justin Cormack
98dfe7ad55 Merge pull request #1721 from riyazdf/more-signing-targets
Signing targets for binfmt, rngd, compilers, toybox, tini
2017-04-27 18:53:49 +01:00
Justin Cormack
dae0e4efae Fix typo "ndodev"
Not sure when this arrived but it was stopping anything running.
Appears not to be in the older test `init` containers.

Signed-off-by: Justin Cormack <justin.cormack@docker.com>
2017-04-27 18:01:05 +01:00
Riyaz Faizullabhoy
38ad84bfbd pull base images with content trust for binfmt, rngd, tini, toybox-media
Signed-off-by: Riyaz Faizullabhoy <riyaz.faizullabhoy@docker.com>
2017-04-26 14:28:30 -07:00
Riyaz Faizullabhoy
78a0d018c1 enable DCT in buildchain for compiler images
Signed-off-by: Riyaz Faizullabhoy <riyaz.faizullabhoy@docker.com>
2017-04-26 12:09:33 -07:00
Ian Campbell
20cfa2af2c Switch fallback hostname to linuxkit-* from moby-*
This was missed when things were renamed.

The intention with this code was (apparently) to provide a (pseudo)unique
hostname in the case where something more specific was not provided (e.g. by
DHCP). Make this a little clearer by using '(none)' rather than 'linuxkit' as
the default, in the normal case this will be overwritten by something more
specific and if it isn't we will change it to something somewhat unique derived
from the MAC address (as before). nb: '(none)' is already used by Debian so I
think it is a safe choice as the sentinel value.

The use of both CONFIG_DEFAULT_HOSTNAME and the explicit /etc/hostname from
mkimage.sh is likely to be redundant in some cases, but neither seems to
completely cover all cases so keep both.

Signed-off-by: Ian Campbell <ian.campbell@docker.com>
2017-04-25 14:09:38 +01:00
Justin Cormack
e79e3a38ad Use containerd to run containers
Because we are not yet using the image store, this requires a
patched `ctr` that can run a specified rootfs rather than an
image.

We will switch to the image store later, but this requires
extensive build changes.

Signed-off-by: Justin Cormack <justin.cormack@docker.com>
2017-04-14 15:35:29 -05:00
Justin Cormack
72c3f9cfa2 More renames to LinuxKit
Signed-off-by: Justin Cormack <justin.cormack@docker.com>
2017-04-14 11:47:24 -05:00
Rolf Neugebauer
0a0786d49e pkg: Update packages to push to linuxkit hub org
Signed-off-by: Rolf Neugebauer <rolf.neugebauer@docker.com>
2017-04-12 21:28:17 +01:00
Rolf Neugebauer
36749ea5c4 build: Switch using c-compile from linuxkit hub org
Signed-off-by: Rolf Neugebauer <rolf.neugebauer@docker.com>
2017-04-12 21:28:17 +01:00
Justin Cormack
3c326bebdf Make / rshared
Previously only `/var` was `rshared` but some people need to share
mounts in `/opt` etc so let us make everything `rshared` for now.

Signed-off-by: Justin Cormack <justin.cormack@docker.com>
2017-04-12 13:10:46 +01:00
Justin Cormack
0ffc2867a9 Use hierarchy for memory cgroups
Container systems expect this...

Signed-off-by: Justin Cormack <justin.cormack@docker.com>
2017-04-10 14:36:06 +01:00
Justin Cormack
821fdaecc8 Remove SELinux setup until actually implemented
Signed-off-by: Justin Cormack <justin.cormack@docker.com>
2017-04-10 14:35:07 +01:00
Justin Cormack
9ee52aa966 Rework how /var is mounted
Instead of mounting a new filesystem, revert to doing a `rw` bind.

However do not make `/` `rshared`, just `/var` as that is where we expect
filesystems to be mounted for persistence. Also only make the actual
container rootfs writeable, not the whole directory.

Signed-off-by: Justin Cormack <justin.cormack@docker.com>
2017-04-10 11:28:00 +01:00
Justin Cormack
bfa76205d5 Change propagation for root
- make / rshared
- make /containers private
- make /var its own tmpfs mountpoint, shared

Signed-off-by: Justin Cormack <justin.cormack@docker.com>
2017-04-09 13:50:04 +01:00
Justin Cormack
c40351a0a8 Make each rootfs a mountpoint by binding
Otherwise shared mounts do not work correctly with `runc`.

Signed-off-by: Justin Cormack <justin.cormack@docker.com>
2017-04-08 21:10:30 +01:00
Justin Cormack
eb22d6909f system → onboot daemon → services
As suggested by @shykes these are clearer

- onboot for things that are run at boot time to completion
- services for persistent services

Signed-off-by: Justin Cormack <justin.cormack@docker.com>
2017-04-08 16:56:47 +01:00
Justin Cormack
a54a694772 Split out init to have standalone runc, containerd
Also add ca-certificates to base, needed to use `dist` to pull.

Make two stage builds for `containerd` and `runc` so they have a
from `scratch` second stage.

Signed-off-by: Justin Cormack <justin.cormack@docker.com>
2017-04-07 16:25:18 +01:00
Thomas Gazagnaire
226d394d15 update runc to version ac50e77bbb440dcab354a328c79754e2502b79ca
Signed-off-by: Thomas Gazagnaire <thomas@gazagnaire.org>
2017-04-07 11:46:34 +02:00
Riyaz Faizullabhoy
8ba64546eb Remount rootfs as read-only after init, /var and /containers mounted as
read-write

Signed-off-by: Riyaz Faizullabhoy <riyaz.faizullabhoy@docker.com>
2017-04-06 09:30:46 -07:00
Ian Campbell
2b54e18f9f Drop unnecessary use of start-stop-daemon with containerd.
Signed-off-by: Ian Campbell <ian.campbell@docker.com>
2017-04-06 09:34:38 +01:00
Ian Campbell
8270bdfe33 Use exec in a couple of places to avoid needless lingering /bin/sh processes
```
$ apk -U add procps
$ ps xf
    1 ?        Ss     0:05 /sbin/init
  357 ?        Ss     0:00 /bin/sh /etc/init.d/containerd
  359 ?        Sl     0:00  \_ /usr/bin/containerd
  360 ?        Ss     0:00 /bin/sh /etc/init.d/containers
  432 ?        Sl     0:00  \_ /usr/bin/runc run --bundle /containers/daemon/swa
  466 ?        Ssl    0:00  |   \_ /usr/bin/swarmd --containerd-addr=/run/contai
  427 ?        Sl     0:00  \_ /usr/bin/runc run --bundle /containers/daemon/dhc
  457 ?        Ss     0:00  |   \_ bin/sh /usr/local/bin/start_dhcpcd.sh
  474 ?        S      0:00  |       \_ /sbin/dhcpcd --nobackground
  429 ?        Sl     0:00  \_ /usr/bin/runc run --bundle /containers/daemon/rng
  576 ?        Ss     0:00      \_ /bin/tini /usr/sbin/rngd -f
  580 ?        S      0:00          \_ /usr/sbin/rngd -f
```

becomes

```
$ ps xf
    1 ?        Ss     0:06 /sbin/init
  358 ?        Ss     0:00 /bin/sh /etc/init.d/containers
  426 ?        Sl     0:00  \_ /usr/bin/runc run --bundle /containers/daemon/dhc
  458 ?        Ss     0:00  |   \_ /sbin/dhcpcd --nobackground
  431 ?        Sl     0:00  \_ /usr/bin/runc run --bundle /containers/daemon/swa
  460 ?        Ssl    0:00  |   \_ /usr/bin/swarmd --containerd-addr=/run/contai
  428 ?        Sl     0:00  \_ /usr/bin/runc run --bundle /containers/daemon/rng
  574 ?        Ss     0:00      \_ /bin/tini /usr/sbin/rngd -f
  578 ?        S      0:00          \_ /usr/sbin/rngd -f
  356 ?        Ssl    0:00 /usr/bin/containerd

```

Specifically these are gone:
  357 ?        Ss     0:00 /bin/sh /etc/init.d/containerd
  457 ?        Ss     0:00  |   \_ bin/sh /usr/local/bin/start_dhcpcd.sh

Signed-off-by: Ian Campbell <ian.campbell@docker.com>
2017-04-06 09:34:38 +01:00
Riyaz Faizullabhoy
a33b9ff4b1 dhcpcd system container
Signed-off-by: Riyaz Faizullabhoy <riyaz.faizullabhoy@docker.com>
2017-04-04 08:23:47 -07:00
Ian Campbell
709402d780 Update to runc ef9a4b315558d31eae520725ff67383c2f79c3cb
This is compatible with containerd 8353da59c6ae7e1933aac2228df23541ef8b163f
which was picked up by d2caae4c1a.

This required jiggering with riddler output some more to update to new OCI
config.json format for capabilities.

Signed-off-by: Ian Campbell <ian.campbell@docker.com>
2017-04-03 16:47:14 +01:00
Ian Campbell
31e0a848e1 pkg/init: ruinc and containerd binaries depend on Makefile
Since Makefile contains the hashes we need a dependency otherwise changing the
hashes does not necessarily result in the binaries getting updated.

Signed-off-by: Ian Campbell <ian.campbell@docker.com>
2017-03-30 17:20:59 +01:00
Rolf Neugebauer
eac2fdd88d init: Enable tty? as console
Enable tty0 and friends as console and start getty on them.

Signed-off-by: Rolf Neugebauer <rolf.neugebauer@docker.com>
2017-03-28 10:46:58 +01:00
Justin Cormack
7b79053306 Update containerd to current master
- now supports image pull and run end to end
- update runc to last version before spec update fix #1302
- remove ext2 utils from init

Signed-off-by: Justin Cormack <justin.cormack@docker.com>
2017-03-25 18:15:52 +00:00
Justin Cormack
905636d642 Move installable packages to pkg
Still leaves some intermediate repos in `base/`

See #1266

Signed-off-by: Justin Cormack <justin.cormack@docker.com>
2017-03-22 12:33:11 +00:00