Commit Graph

715 Commits

Author SHA1 Message Date
Ian Campbell
9bb87c0091 Remove unused pkg/package.mk
All uses now converted to `linuxkit pkg`

Signed-off-by: Ian Campbell <ijc@docker.com>
2017-10-09 16:40:33 +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
ca70b7b6af Update pkg/Makefile and test/pkg/Makefile based on tools/Makefile
Using explicit targets is cleaner and easier to follow.

Also add `forcepush` to pkg and test/pkg and make `push` explicit.

The `dirs` phony was non-existent in all three cases. Likewise `$(DIR)` wasn't
used in that way in pkg or test/pkg and is nolonger used in that way in tools.

Finally, `clean` was bogus in all cases (tools cleaned a thing which never
exists and pkg and test/pkg were a syntax error).

Signed-off-by: Ian Campbell <ijc@docker.com>
2017-10-09 16:20:08 +01:00
Justin Cormack
d0882b9674 Merge pull request #2571 from ijc/linuxkit-pkg
Implement package build, push and show-tag in linuxkit tool
2017-10-09 13:59:02 +01:00
Nick Jones
6deabe8a2f
[OpenStack] Metadata service support
This commit adds support for retrieving instance metadata on OpenStack
public clouds.

Signed-off-by: Nick Jones <nick@dischord.org>
2017-10-08 17:08:00 +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
f8b80b6f00 pkg: correct tagging forced release
Signed-off-by: Ian Campbell <ijc@docker.com>
2017-10-06 12:56:33 +01:00
Rolf Neugebauer
d8283fc769 pkg: Update alpine base for getty/ip/sshd
These packages include the wireguard tools which need to be
updated due to the wireguard kernel bump in:
43db718f14 ("wireguard: version bump").

Signed-off-by: Rolf Neugebauer <rolf.neugebauer@docker.com>
2017-10-06 11:16:10 +01:00
Isaac Rodman
3de78f2109 format: blkid content check, format argument, and verbose argument
- Added new argument -force to the format utility. This will force formatting of the specified single device if it exists and is a block device
- By default, the format package will no longer format the specified single device if content exists on that device
- Added new blkid-based check for content, in addition to the existing check for partitions on autoformat candidate devices.
- Cleanup of old unused code.
- Refactoring of block device verification.
- Added test/cases/040_packages/006_format_mount/005_by_device_force
- Added document of new arguments to /docs/external-disk.md. Also sorted the arguments in the doc alphabetically and added them as bullets so they do not run together on the page.

Signed-off-by: Isaac Rodman <isaac@eyz.us>
2017-10-02 11:53:17 -07:00
Ian Campbell
2582614135 pkg/mount: also create /dev/disk/by-uuid links
Some software (such as cri-containerd and kubelet) rely on the presence of
these links, which are usually created by udev.

Inspired by 74b145b5c7/sourceroot/functions.sh (L93...L124)
but rewritten in go.

Signed-off-by: Ian Campbell <ijc@docker.com>
2017-09-27 16:39:58 +01:00
Rolf Neugebauer
5c37a154da Merge pull request #2536 from rn/lcow-kern
Update kernel and LCOW
2017-09-25 15:27:15 +01:00
Rolf Neugebauer
02f0049172 pkg/init-lcow: Update OpenGCS to latest version
While at it, might as well update alpine base

Signed-off-by: Rolf Neugebauer <rolf.neugebauer@docker.com>
2017-09-25 13:44:40 +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
b52fcb71a1 Add swap to the Docker for Mac blueprint
We always had 1G swap to work better with small memory setups, but this
was omitted in the update to LinuxKit.

Signed-off-by: Justin Cormack <justin.cormack@docker.com>
2017-09-21 14:50:27 -07:00
Rolf Neugebauer
cc200d296a Merge pull request #2527 from eyz/linuxkit-dhcpcd-CAP_SYS_ADMIN
added capability to pkg/dhcpcd for sethostname
2017-09-21 20:53:16 +01:00
Isaac Rodman
0add33e288 added capability to pkg/dhcpcd for sethostname
Signed-off-by: Isaac Rodman <isaac@eyz.us>
2017-09-20 15:11:43 -07:00
Justin Cormack
498086dbb9 Update containerd to use pre-built version
Signed-off-by: Justin Cormack <justin.cormack@docker.com>
2017-09-20 14:24:10 -07:00
Rolf Neugebauer
d9ffc57532 pkg: Update the getty, ip, and sshd package to latest alpine base
These packages use the wireguard tools which have been updated
with the previous commit.

Signed-off-by: Rolf Neugebauer <rolf.neugebauer@docker.com>
2017-09-20 11:46:48 +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
Isaac Rodman
38452aa742 added poweroff.sh for pkg/open-vm-tools to allow shutdown from hypervisor
Signed-off-by: Isaac Rodman <isaac@eyz.us>
2017-09-16 10:39:23 -07:00
Rolf Neugebauer
6845f602dc Merge pull request #2506 from eyz/master
new pkg/modprobe from linuxkit/alpine base onto scratch
2017-09-16 17:21:15 +01:00
Rolf Neugebauer
d38ea16f4a Merge pull request #2513 from rn/lcow-kernel
Update 4.12.13 kernel patches and use it for LCOW
2017-09-15 21:41:44 +01:00
Isaac Rodman
0cce316caa pkg/modprobe from linuxkit/alpine base, using established multistage build onto scratch pattern
Signed-off-by: Isaac Rodman <isaac@eyz.us>
2017-09-15 12:38:40 -07:00
Justin Cormack
9d55b197c0 Merge pull request #2483 from zx2c4/custom-wg-script
wireguard: use custom wg-quick
2017-09-15 09:51:54 -07:00
Rolf Neugebauer
adb92ca672 pkg/init-lcow: Update to the latest version
This includes fixes to the intermittent on pull as well as
other fixes.

Signed-off-by: Rolf Neugebauer <rolf.neugebauer@docker.com>
2017-09-15 14:47:12 +01:00
Jason A. Donenfeld
8f3847e985 wireguard: use custom wg-quick
This removes things we do not need and expects the interface to
already be created.

Signed-off-by: Justin Cormack <justin.cormack@docker.com>
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2017-09-15 01:01:55 +02: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
Rolf Neugebauer
36c84004a2 pkg/init-lcow: Update to latest version of OpenGCS
Signed-off-by: Rolf Neugebauer <rolf.neugebauer@docker.com>
2017-09-12 16:59:07 +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
Rolf Neugebauer
3ebec6f3e8 pkg/init-lcow: Update to latest OpenGCS version
While at it also update to latest alpine base

Signed-off-by: Rolf Neugebauer <rolf.neugebauer@docker.com>
2017-09-06 08:54:14 +01:00
Rolf Neugebauer
2cb0612011 pkg/lcow: Update OpenGCS to latest
Signed-off-by: Rolf Neugebauer <rolf.neugebauer@docker.com>
2017-08-30 19:41:02 +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
Justin Cormack
2129d1de21 Merge pull request #2450 from justincormack/improve-wireguard-example
Improve wireguard example
2017-08-22 17:44:01 +01:00
Justin Cormack
584613cddb Update ip package to latest Alpine base
There was a wireguard mismatch with the kernel module in the recent kernel
builds.

Signed-off-by: Justin Cormack <justin.cormack@docker.com>
2017-08-22 11:50:20 +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
a808808ce1 Add vendoring needed for netlink, packet
Signed-off-by: Justin Cormack <justin.cormack@docker.com>
2017-08-19 19:25:21 +01:00
Justin Cormack
92451cf2e4 Add packet metadata support, with bonding
Use the packet metadata to set up bonding, also get ssh keys and hostname.

This does not yet do anything with disk metadata.

Userdata is not used if it has been used for ipxe, but is otherwise available.

Signed-off-by: Justin Cormack <justin.cormack@docker.com>
2017-08-19 19:25:14 +01:00
Rolf Neugebauer
5898bc9f0d kernel: Update to 4.9.44/4.4.83
Signed-off-by: Rolf Neugebauer <rolf.neugebauer@docker.com>
2017-08-18 18:08:32 +01:00
Justin Cormack
9506d45d49 Merge pull request #2413 from justincormack/runtime-config
Add a runtime config
2017-08-18 17:45:10 +01:00
Justin Cormack
9d8f1bd900 Allow specifying a set of metadata providers
run with `cmd: ["metadata", "aws"]` to just check for AWS metadata for example.

Signed-off-by: Justin Cormack <justin.cormack@docker.com>
2017-08-17 14:50:50 +01:00
Justin Cormack
57512b3ec9 Add an ip package
This contans the upstream (non busybox) version of `ip` and also the
Wireguard tools as these aere not yet integrated into `ip`. It is designed
to be used for network configuration.

For example a Wireguard interface can be setup with something like:
```
  - name: wg
    image: linuxkit/ip
    net: new
    binds:
      - /etc/wireguard:/etc/wireguard
    command: ["sh", "-c", "ip link set dev wg0 up; ip address add dev wg0 192.168.2.1 peer 192.168.2.2; wg setconf wg0 /etc/wireguard/wg0.conf; wg show wg0"]
    runtime:
      interfaces:
        - name: wg0
          add: wireguard
          createInRoot: true
      bindNS:
          net: /run/netns/wg
```

This binds the net namespace so other containers can use it later.

Note that `ip` supports batch scripts with `ip -b file` which is quite convenient for
this use case.

Alas `wg-quick` requires `bash` so this is currently a bit bloated, maybe @zx2c4
might be persuaded to rewrite it without bashisms...

Signed-off-by: Justin Cormack <justin.cormack@docker.com>
2017-08-17 12:18:38 +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
Rolf Neugebauer
f9f8b5bc42 pkg/lcow-init: Update to latest version of OpenGCS
While at it also update to latest alpine base

Signed-off-by: Rolf Neugebauer <rolf.neugebauer@docker.com>
2017-08-16 16:50:34 +01:00
Rolf Neugebauer
714dbcf0fe Merge pull request #2399 from ijc/pkg-honour-hash-override
package: Do not add an arch suffix if an explicit HASH is given
2017-08-14 10:14:04 +01:00
Ian Campbell
e11c1c0224 pkg: Bump to containerd v1.0.0-alpha4 and runc v1.0.0-rc4
Signed-off-by: Ian Campbell <ijc@docker.com>
2017-08-11 16:16:33 +01:00
Ian Campbell
0469901778 package: Do not add an arch suffix if an explicit HASH is given
During development I tend to do:
	make -C pkg/foo tag HASH=dev ORG=ijc
and I expect to get an image `ijc/foo:dev` and not `ijc/foo:dev-amd64`. In
general I think if the HASH has been explicitly provided the build should
just honour that.

To compensate and avoid mistaken pushes adjust the check for dirtiness to also
insist on a non-empty suffix.

Signed-off-by: Ian Campbell <ijc@docker.com>
2017-08-11 11:26:00 +01:00
Justin Cormack
c42ddc0af8 Fix root directory permissions with overlay
At least when running under Docker this seems to cause some issues,
possibly also explains some other oddnesses.

Signed-off-by: Justin Cormack <justin.cormack@docker.com>
2017-08-10 14:22:12 +01:00
Rolf Neugebauer
46d1e568cc pkg/init-lcow: Update opengcs
This has a number of fixes/improvements
- console resize
- better error handling (pass stacktrace/errors back to docker
- fix for container images which have a resolve.conf file

Signed-off-by: Rolf Neugebauer <rolf.neugebauer@docker.com>
2017-08-08 17:53:27 +01:00
Justin Cormack
e61794a344 Merge pull request #2365 from deitch/test-dev-existence-getty
Test dev existence getty
2017-08-07 20:32:39 +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
Ian Campbell
6ef10ae33b Update to containerd v1.0.0-alpha3 and runc master
Runc is master as of this morning, slightly newer than what is vendored into
containerd v1.0.0-alpha3 but the differences[0] seemed benign and/or good to have.

Signed-off-by: Ian Campbell <ijc@docker.com>

[0] 429a538712...45bde006ca
2017-08-07 11:47:44 +01:00
Avi Deitcher
cc174b4df0 test device exists before allowing getty to run
Signed-off-by: Avi Deitcher <avi@deitcher.net>
2017-08-06 10:23:12 +03:00
Rolf Neugebauer
dfa684c78f pkg/init-lcow: Update to tip of opengcs
Also adjust the building of the rootfs as this seem to have
changed.

Signed-off-by: Rolf Neugebauer <rolf.neugebauer@docker.com>
2017-08-04 18:34:56 +01:00
Justin Cormack
0b2e34301b Merge pull request #2357 from justincormack/arm64-rngd
Support rngd on arm64
2017-08-04 16:13:46 +01:00
Justin Cormack
8b2327b0e2 Support rngd on arm64
Although it does not do anything, as there is no CPU rng on arm64 at present.

Signed-off-by: Justin Cormack <justin.cormack@docker.com>
2017-08-04 14:01:18 +01:00
Justin Cormack
ce2347eda6 Enable sysctl kernel.dmesg_restrict
This requires that users have `CAP_SYSLOG` in order to access `dmesg`.
This means that containers by default have no access to `dmesg` (which
can leak information about the host or other containers) unless they
have this capability added.

Signed-off-by: Justin Cormack <justin.cormack@docker.com>
2017-08-04 12:48:27 +01:00
Rolf Neugebauer
fee2a62f26 pkg: Disable some packages for arm64
They either won't work or the packages are specific
to x86_64 like the DfM or VMware packages.

Signed-off-by: Rolf Neugebauer <rolf.neugebauer@docker.com>
2017-08-03 17:46:11 +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
Rolf Neugebauer
0ebb53c491 build: Add the ability to only build/push/sign for specific architectures
A package makefile can specify a list of architectures ('ARCHES')
it supports. If build on a unsupported architecture, a message is
printed and make exits without an error.

Signed-off-by: Rolf Neugebauer <rolf.neugebauer@docker.com>
2017-08-03 17:36:22 +01:00
Rolf Neugebauer
981def7c7a build: Add show-tag and forcetag targets to pkg Makefile
Signed-off-by: Rolf Neugebauer <rolf.neugebauer@docker.com>
2017-08-03 17:36:22 +01:00
Rolf Neugebauer
c8e0d2ca28 pkg: Add invocation to push-manifest to generic package build
Signed-off-by: Rolf Neugebauer <rolf.neugebauer@docker.com>
2017-08-03 17:36:22 +01:00
Rolf Neugebauer
47af521e14 Merge pull request #2343 from justincormack/x-sys-unix-rngd
rngd improvements
2017-08-03 15:45:40 +01:00
Justin Cormack
4434ecc4af Support multiple CDROMS in metadata
This checks if any CDROM in the system has metadata. Useful if
you boot off CDROM and also have a metadata CDROM.

Also switch the metadata container to read only, as it is only
writing to bind mounted in directories, and /tmp.

Signed-off-by: Justin Cormack <justin.cormack@docker.com>
2017-08-03 14:16:02 +01:00
Justin Cormack
f768ac4bfd Add flags to disable the different random sources
This makes testing the different options much easier.

Signed-off-by: Justin Cormack <justin@specialbusservice.com>
2017-08-02 20:55:36 +01:00
Justin Cormack
63798997f6 Convert rngd to use x/sys/unix
Epoll in `syscall` package does not work on arm64. We do not have
arm64 yet here, but we will when we add tpm support etc.

Signed-off-by: Justin Cormack <justin@specialbusservice.com>
2017-08-02 20:09:43 +01:00
Rolf Neugebauer
767ac54971 pkg/init-lcow: Update opengcs to the latest version
Signed-off-by: Rolf Neugebauer <rolf.neugebauer@docker.com>
2017-08-01 17:06:12 +01:00
Justin Cormack
4daf008956 Merge pull request #2331 from justincormack/rng-golang
Replace rngd with a Go version
2017-08-01 10:56:10 +01:00
Justin Cormack
b1c80b54b3 Revert #2317 remove kernel.random.write_wakeup_threshold from sysctl
Signed-off-by: Justin Cormack <justin.cormack@docker.com>
2017-07-31 23:05:46 +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
e0bc13451f Replace rngd with a Go version
Only supports the use cases we currently need, currently support
for using Intel hardware rng to initialise and add entropy.

Supports oneshot and service mode. Call as `rngd -1` for one shot
mode.

Signed-off-by: Justin Cormack <justin.cormack@docker.com>
2017-07-31 20:16:26 +01:00
Justin Cormack
1412cf8835 Fix mode of created directories in mountie
Signed-off-by: Justin Cormack <justin.cormack@docker.com>
2017-07-31 17:31:40 +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
5ea2eaead1 Merge pull request #2309 from justincormack/ro-rw-setup
Use overlay for writeable containers
2017-07-31 15:25:09 +01:00
Justin Cormack
eacce1d52e Use overlay for writeable containers
Previously we would sneakily remount as `rw` but of course you can't
really do that on a truly immutable filesystem.

See https://github.com/moby/tool/pull/129 for the `moby` side.

Signed-off-by: Justin Cormack <justin.cormack@docker.com>
2017-07-31 13:48:23 +01:00
Dennis Chen
bbfb7a7442 pkg/getty: Add ARM 'ttyAMA0' console into securetty
We need to add 'ttyAMA0' console used on ARM64 platform into
securetty file to make it's possible to log into the system
as root. Also it will dismiss the below warning message before
login:
"getty: cmdline has console=ttyAMA0 but does not exist in
/etc/securetty; will not be able to log in as root on this tty ttyAMA0."

'ttyAMA1' is also added order to handle some system happens have that one
instead of 'ttyAMA0'

Signed-off-by: Dennis Chen <dennis.chen@arm.com>
2017-07-31 10:27:03 +00:00
Riyaz Faizullabhoy
ade82574e6 Merge pull request #2317 from justincormack/sysctl-fix
Remove kernel.random.write_wakeup_threshold from sysctl
2017-07-28 13:22:38 -07:00
Justin Cormack
980a469bbc Remove kernel.random.write_wakeup_threshold from sysctl
3072 is the default value anyway, so no need to change.

Signed-off-by: Justin Cormack <justin.cormack@docker.com>
2017-07-28 17:56:13 +01:00
Dennis Chen
d9e5e41df3 package.mk: Adjust the targe sequence to avoid early abort
Current package.mk will operate on the first dependence object
'check-dirty', which will result the make process abort earlier
with below message:
pkg/package.mk:60: *** Your repository is not clean. Will not push package image.  Stop.

This is not expected behavior since we have no chance to build
a docker image locally in case of the user has no intention to
push that image.

This patch adjust the dependece order for the default target, thus
we can build the docker image locally but can't push that image
since we're in a dirty git repository.

Signed-off-by: Dennis Chen <dennis.chen@arm.com>
2017-07-28 11:05:26 +00:00
Justin Cormack
9a823cf2e2 Add mountpoint to binfmt image
As this is read only it should be explicitly created.

Signed-off-by: Justin Cormack <justin.cormack@docker.com>
2017-07-27 15:05:48 +01:00
Avi Deitcher
8f10f69fd3 Merge pull request #2233 from dave-tucker/ns-detect
getty: Detect if you are in a namespace
2017-07-27 16:50:02 +03:00
Avi Deitcher
543e61c643 Fix typo
Signed-off-by: Avi Deitcher <avi@deitcher.net>
2017-07-27 15:38:20 +03:00
Justin Cormack
16674a1557 Merge pull request #2306 from ijc/containerd-v1.0.0-alpha2
Containerd v1.0.0 alpha2
2017-07-27 13:30:24 +01:00
Dave Tucker
f41c976406 getty: Detect if you are in a namespace
This is an attempt at fixing #2213

If `INITGETTY` has been set then we are not in a namespace.

Signed-off-by: Avi Deitcher <avi@deitcher.net>
2017-07-27 14:55:28 +03:00
Ian Campbell
8eb6709a3c containerd: Bump to new alpine (with v1.0.0-alpha2)
The logrus import path has changed, so adjust. Also there is a minor API change
to the containerd.IOCreation() function spec, it now takes a string id which we
can ignore.

Signed-off-by: Ian Campbell <ijc@docker.com>
2017-07-27 11:07:03 +01:00
Rolf Neugebauer
a18f4403d0 pkg/init-lcow: Update opengcs to latest
While at it, might as well update linuxkit/alpine to the latest.

Signed-off-by: Rolf Neugebauer <rolf.neugebauer@docker.com>
2017-07-27 10:47:19 +01:00
Justin Cormack
941e31a519 Merge pull request #2278 from deitch/tpm-tools
tpm tools
2017-07-26 22:01:51 +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
5194bf13d1 Merge pull request #2296 from justincormack/service-does-more
Make service start up containerd and services
2017-07-26 15:34:03 +01:00
Rolf Neugebauer
2b76e86500 Merge pull request #2152 from dave-tucker/multi-mount
Improve mount and format packages
2017-07-26 14:39:28 +01:00
Justin Cormack
b8f7b7aad0 Merge pull request #2294 from ijc/pkg-forcepush
pkg: Add forcepush target
2017-07-26 13:43:12 +01:00
Dave Tucker
8dcb57429a pkg: Add extend for extending partitions
This was split out from pkg/format into its own package.
It has the ability to extend ext4, btrfs and xfs partitions.

Signed-off-by: Dave Tucker <dt@docker.com>
2017-07-26 13:26:39 +01:00
Dave Tucker
a14a8be49e mount: Add support to mount by label, uuid or name
This commit rewrites the mount package in Go.
It adds the ability to mount the by label, UUID or name.
It also fixes the automatic mount logic to check that a drive isn't
already mounted before attempting to mount it. This allows for multiple
uses of the mount pkg in a single YAML file.

Signed-off-by: Dave Tucker <dt@docker.com>
2017-07-26 13:26:39 +01:00
Dave Tucker
5273ec1d33 format: Add partition labels and new filesystems
This commit re-writes the format package in Go and adds the ability to
add partition labels and also specify either ext4, btrfs or xfs

Signed-off-by: Dave Tucker <dt@docker.com>
2017-07-26 13:26:39 +01:00
Justin Cormack
e40db14598 Make service start up containerd and services
This moves most of the initialisation of containers to the
service init in the `service` command.

Still leaves remounting root file systems read only but this
will go away shortly. Another step closer to removing shell
scripts in base system.

Signed-off-by: Justin Cormack <justin.cormack@docker.com>
2017-07-26 12:05:45 +01:00
Avi Deitcher
e776d063ac add tss image
Signed-off-by: Avi Deitcher <avi@deitcher.net>
2017-07-26 13:46:51 +03:00
Ian Campbell
6c689a84dd pkg: Add forcepush target
This is like the `push` target but omits the pulls and depends on forcetag
instead. With the git commit now being embedded into the image this is now a
necessary part of rebasing a PR for which images have already been pushed.

Also adds PHONY targets for existing forcetag and push targets which were
missing.

NB $(error) appends a "." to omit the final one from the error message

Signed-off-by: Ian Campbell <ijc@docker.com>
2017-07-26 10:45:04 +01:00
Justin Cormack
797392a244 fix openntpd label
Signed-off-by: Justin Cormack <justin.cormack@docker.com>
2017-07-25 16:25:09 +01:00
Justin Cormack
1e236e9f0c Update build labels for new resolv.conf bind mount
Signed-off-by: Justin Cormack <justin.cormack@docker.com>
2017-07-25 15:30:24 +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
Avi Deitcher
8de1d9bf2c Mount /var/log to getty and ssh again
Signed-off-by: Avi Deitcher <avi@deitcher.net>
2017-07-21 19:11:22 +03:00
Jason A. Donenfeld
ec7dadcddd wireguard: add to getty and sshd
People really want to play around with this, so adding them here makes
it possible. Just as iproute2 is part of these, so should
wireguard-tools.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2017-07-20 23:50:13 +02:00
Ian Campbell
c48acd5d9d sshd+getty: Add apk to these containers
Since these are the user login containers, having the ability to add packages
is useful (e.g. I quite often find I want strace).

Doing this requires that we not share `/var` with the login containers since we
want the apk database therein. Previously it was thought that the containers
might need some parts of `/var` for `ctr` to work (e.g. `/var/lib/containerd`)
but this is not the case now (if it ever was) based on my testing.

Fixes #2206.

Signed-off-by: Ian Campbell <ijc@docker.com>
2017-07-20 15:08:27 +01:00
Justin Cormack
5545f3085a Merge pull request #2258 from ijc/containerd-v1.0.0-alpha1
Containerd v1.0.0 alpha1
2017-07-20 15:07:24 +01:00
Ian Campbell
b3db1a887c Update to containerd v1.0.0-alpha1
This is actually containerd#1141 rebased onto v1.0.0-alpha1.

The `dist` command has been integreated into `ctr` and so is removed, including
from the getty and sshd bind mounts and the test which uses it is updated..

There is no change to the version of runc vendored by containerd, so this is
unchanged.

Signed-off-by: Ian Campbell <ijc@docker.com>
2017-07-20 14:10:51 +01:00
Rolf Neugebauer
c1eacd07b7 Merge pull request #2256 from djs55/secrets
metadata: avoid printing large chunks of configuration json to the console
2017-07-20 13:17:50 +01:00
David Scott
5bf6526380 metadata: avoid printing large chunks of configuration json to the console
If the configuration .json has contents like:

{
  "etc": {
    "ssl": {
      "certs": {
        "ca-certificates.crt": {
          "perm": "0644",
          "content": "large amount of certificate text"
        }
      }
    }
  },
...
}

then we print a warning because the node "ssl" has no "perm".
Previously the warning would include the contents of "ssl", which
would be large (and in theory could include secret information).

This patch modifies the warning print to only print the key and
not the value.

Without this patch, I see on the console:

2017/07/20 10:03:04 CDROM: Probe succeeded
2017/07/20 10:03:04 No permission provided ssl:map[certs:map[ca-certificates.crt:map[perm:0644 content:large amount of certificate text]]]
 - 000-metadata

With this patch, I see on the console:

2017/07/20 09:54:18 CDROM: Probe succeeded
2017/07/20 09:54:18 No permission provided ssl
 - 000-metadata

Signed-off-by: David Scott <dave.scott@docker.com>
2017-07-20 11:10:59 +01:00
Rolf Neugebauer
c28a472ba2 pkg/init-lcow: Use main opengcs repository again
My patches have been merged.

Signed-off-by: Rolf Neugebauer <rolf.neugebauer@docker.com>
2017-07-20 11:02:05 +01:00
Rolf Neugebauer
35e274c7d8 Merge pull request #2245 from rn/lcow-init
Additional LCOW fixes
2017-07-19 15:27:01 +01:00
Rolf Neugebauer
7eb81ba38c pkg/init-lcow: Include fix for rootfs permissions
Update the git commit to point at a branch with the joint
networking and rootfs permission fixes at:
https://github.com/rn/opengcs/tree/net+rootfs

This is includes the patches from PRs:
https://github.com/Microsoft/opengcs/pull/63
https://github.com/Microsoft/opengcs/pull/70

Signed-off-by: Rolf Neugebauer <rolf.neugebauer@docker.com>
2017-07-19 12:20:52 +01:00
Rolf Neugebauer
9ba7fee7e6 pkg/init-lcow: Use our own init
The sample init script from opengcs is quite basic (and doesn't
set up several mounts and symlinks). Use the relevant portion
from rc.init from the LinuxKit init package instead.

Signed-off-by: Rolf Neugebauer <rolf.neugebauer@docker.com>
2017-07-19 10:40:49 +01:00
Ian Campbell
56a8d2468a kubernetes: modernise image cache builds
This updates the build of the two image caches to use the `pkg/package.mk`
infrastructure, albeit in a slightly (ok, very) atypical way.

In order to share the bulk of the build code (including the `Dockerfile` and
the `Makefile` machinery to download the images) we arrange for the necessary
bits to be copied at build time into distinct subdirectories and for the
`pkg/package.mk` to be aware of this possibility.

Since pkg/package.mk is only set up to build a single package we use a single
`image-cache/Makefile` to drive the whole process and recurse into
`Makefile.pkg` to build individual packages.

One particular subtlety is that the package hash is based on the `image-cache`
directory (which is in `git`) rather than the generated subdirectories (which
are not in `git`). Since all the generators (and their inputs) are in the
`image-cache` directory this is what we want. This means that the two images
are given the same tag, but this is deliberate and desirable.

The generated directories are completely temporary to avoid picking up stale
versions of images when versions are updated. Images are hardlinked into place.

The images are moved to the linuxkitprojects org. Using a dev tag for now, will
update once everything is in place.

Also use "tag" rather than "build" where appropriate in the Makefile.

There is no point in the .dockerignore now, but add a .gitignore.

Signed-off-by: Ian Campbell <ijc@docker.com>
2017-07-19 09:51:32 +01:00
Rolf Neugebauer
c073b0ebd6 Merge pull request #2242 from rn/lcow-net
Fix networking in LCOW
2017-07-18 20:02:47 +01:00
Avi Deitcher
0f725c366e Merge pull request #2241 from deitch/fix-getty-background
flag in init and background only if not in init
2017-07-18 21:39:53 +03:00
Justin Cormack
09e9357499 Merge pull request #2235 from justincormack/use-library-docker
Use the upstream dind package to run docker
2017-07-18 17:27:45 +01:00
Rolf Neugebauer
4ff7916e10 pkg/init-lcow: Temporarily use a branch of my dev tree
The branch has fixes to the networking setup (see
https://github.com/Microsoft/opengcs/issues/56 and
https://github.com/Microsoft/opengcs/pull/63)

Also remove runc from the package as the hard-coded runc
path has been removed (see
https://github.com/Microsoft/opengcs/pull/58)

Signed-off-by: Rolf Neugebauer <rolf.neugebauer@docker.com>
2017-07-18 15:44:20 +01:00
Avi Deitcher
af0331d382 flag in init and background only if not in init
Signed-off-by: Avi Deitcher <avi@deitcher.net>
2017-07-18 16:37:05 +03:00
Justin Cormack
c6aa7b9053 Add onshutdown support to runc
This will run any containers in `/containers/onshutdown` on a clean
shutdown.

Signed-off-by: Justin Cormack <justin.cormack@docker.com>
2017-07-18 11:54: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
Justin Cormack
a4650b242f Use the upstream dind package to run docker
It is pretty close to our docker package, if we adjust the command
that is run to avoid the actual dind startup script. We can't use
the normal docker image as it does not have mkfs and so on.

Signed-off-by: Justin Cormack <justin.cormack@docker.com>
2017-07-18 11:15:38 +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
07469ac60b Merge pull request #2207 from justincormack/getty-x
remove -x from getty script
2017-07-15 12:38:52 +01:00
Justin Cormack
98ed378dbd Add a securetty file
Do not copy host securetty file - this one should be comprehensive
or bind mount host one in yourself.

Signed-off-by: Justin Cormack <justin.cormack@docker.com>
2017-07-14 18:34:52 +01:00
Riyaz Faizullabhoy
469ba103db Merge pull request #2209 from ijc/expurgate-set--x
pkg/mount: Remove set -x
2017-07-14 09:58:36 -07:00
Riyaz Faizullabhoy
66e328e38d Merge pull request #2211 from justincormack/runc-static-pie
Make runc a static pie executable
2017-07-14 09:56:56 -07:00
Justin Cormack
36df256177 Merge pull request #2202 from rn/lcow2
Add experimental support for LCOW
2017-07-14 16:58:01 +01:00
Justin Cormack
53d5ea42c4 Build runc as static pie
This was waiting on the runc update which added ability to add extra flags.

Signed-off-by: Justin Cormack <justin.cormack@docker.com>
2017-07-14 15:38:32 +01:00
Ian Campbell
77ec9bced3 pkg/mount: Remove set -x
Noisy.

Signed-off-by: Ian Campbell <ijc@docker.com>
2017-07-14 15:21:01 +01:00
Rolf Neugebauer
cbc8d4a21c pkg: Add LCOW init package
This package build the init filesystem for LCOW (Linux Containers
on Windows) based on the instructions from:
https://github.com/Microsoft/opengcs.git

We also pull in a udhcpd config script from a specific version of
busybox which was the tip of master at the time this was added.

Signed-off-by: Rolf Neugebauer <rolf.neugebauer@docker.com>
2017-07-14 15:02:42 +01:00
Justin Cormack
ecaa7f9c68 Remove the -x from the rungetty script
Its annoyingly verbose!

Signed-off-by: Justin Cormack <justin.cormack@docker.com>
2017-07-14 13:53:45 +01:00
Ian Campbell
538c8b5a7b containerd: Add a service command to cleanup stale containers on boot
This may occur if /var/lib/container happens to be on persistent storage.

Signed-off-by: Ian Campbell <ijc@docker.com>
2017-07-14 13:50:46 +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
Ian Campbell
902e6182b0 Temporarily use https://github.com/containerd/containerd/pull/1141
We expect this (or something very similar) to be merged soon, it fixes #2131 so
moving ahead now.

The new alpine mirror is linuxkit/alpine:6832775a7e861ee2d7842e157688ece52d007142

Signed-off-by: Ian Campbell <ijc@docker.com>
2017-07-13 10:42:55 +01:00
Ian Campbell
c5634c4650 Define CONTAINERD_REPO alongside CONTAINERD_COMMIT in tools/alpine
This will make it simpler to temporarily in PRs which are not yet merged (but
are expected to be soon).

Tools alpine is not rebuilt here since we are going to do just that in the next
commit.

Signed-off-by: Ian Campbell <ijc@docker.com>
2017-07-13 10:38:27 +01:00
Ian Campbell
a2d3be0e6f Update runc and containerd
pull in newer containerd v1.0.0-alpha0 via updated alpine base, update runc to
429a5387123625040bacfbb60d96b1cbd02293ab which is vendored by that version of
containerd (and also update alpine base for runc)

Signed-off-by: Ian Campbell <ian.campbell@docker.com>
2017-07-13 10:37:15 +01:00
Justin Cormack
f98a56fc2c Merge pull request #2179 from deitch/read-only-securetty
Use existing securetty
2017-07-11 23:19:43 +01:00
Justin Cormack
9b4bce1e40 Add forcetag to package build
Use this if you really need to rebuild a package, eg if you change `pakcage.mk`

Signed-off-by: Justin Cormack <justin.cormack@docker.com>
2017-07-11 16:35:58 +01:00
Justin Cormack
ed38adbc90 Add labels for repo and commit to packages
- use image spec metadata https://github.com/opencontainers/image-spec/blob/master/annotations.md
- omit commit if dirty

Signed-off-by: Justin Cormack <justin.cormack@docker.com>
2017-07-11 14:33:59 +01:00
Avi Deitcher
5d18cba75f Use existing securetty
Signed-off-by: Avi Deitcher <avi@deitcher.net>
2017-07-11 14:43:26 +03:00
Justin Cormack
298f4aab32 Consistently don't use quotes around image names
These are not needed, but we are inconsistent. Been waiting for a
quiet moment to fix this since I noticed while doing a presentation...

Signed-off-by: Justin Cormack <justin.cormack@docker.com>
2017-07-09 17:47:30 +01:00
Rolf Neugebauer
c3bc803445 Merge pull request #2164 from rn/meta
Allow metadata package to over write existing config files
2017-07-07 19:48:09 +01:00
Rolf Neugebauer
4e19cf363a Merge pull request #2119 from djs55/host-timesync-daemon
Add Docker for Mac host time sync daemon
2017-07-07 19:17:20 +01:00
Rolf Neugebauer
f021bb8aaa pkg: In the metadata package, don't error if a dir exists
Use os.Mkdirall() instead of os.Mkdir() as it does not
error if the path already exists.

This enables specifying a default config file with the image
and then over writing it with metadata.

While at it, also update to the latest alpine base image.

Signed-off-by: Rolf Neugebauer <rolf.neugebauer@docker.com>
2017-07-07 18:29:02 +01:00
David Scott
d24d0bd559 Add pkg/host-timesync-daemon
Some hypervisors (e.g. hyperkit / xhyve) don't provide a good way to keep
the VM's clock in sync with the Host's clock. NTP will usually keep the
clocks together, but after a the host or VM is suspended and resumed the
clocks can be suddenly too far apart for NTP to work properly.

This simple daemon listens on an AF_VSOCK port and resynchronises the VM
clock from the virtualised hardware clock.

This is a Go conversion of original C code written by
Magnus Skjegstad <magnus@skjegstad.com>

Signed-off-by: David Scott <dave.scott@docker.com>
2017-07-07 11:35:36 +01:00
Ian Campbell
aee080f621 pkg: Reduce the number of times variables containing $(shell...) are invoked.
For DIRTY and RELEASED this means simply performing a static assignment with
`:=`. For HASH it is a little more complex since it is (and we want/need it to
be) a conditional assigment. However it is only used for defining TAG, so make
that a static assignment.

This reduces the number of times the complex DIRTY shell command in particular
is evaluated.

Signed-off-by: Ian Campbell <ian.campbell@docker.com>
2017-07-06 16:33:08 +01:00
Ian Campbell
4fba9d8545 pkg: Update content trust handling.
Firstly add option to disable content trust, for the use of e.g. projects which
are pushing to the linuxkitprojects org (which has no trust setup) rather than
the main linuxkit org.

Secondly, when trust _is_ enabled then enable it globally, in particular it is
now active for the `docker build` and hence containers referenced in
Dockerfiles via "FROM" will be checked.

Signed-off-by: Ian Campbell <ian.campbell@docker.com>
2017-07-06 16:20:34 +01:00
Magnus Skjegstad
ba8be57eef pkg: add acpid
Adds a new service for running `/sbin/acpid` that comes with busybox.
The VM will shut down if the power button is pressed.

Signed-off-by: Magnus Skjegstad <magnus@skjegstad.com>
2017-07-05 22:37:46 +02: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
Ian Campbell
fe918f8a31 pkg: Run git update-index --refresh before git diff-index.
Otherwise files which have an updated timestamp but no actual changes are
marked as changes because `git diff-index` only uses the `lstat` result and not
the actual file contents. Running `git update-index --refresh` updates the
cache.

Signed-off-by: Ian Campbell <ian.campbell@docker.com>
2017-07-03 10:27:31 +01:00
Ian Campbell
7fd155b38d pkg: Do not mark user supplied HASH as dirty
If a user passes a HASH e.g. HASH=dev then assume they know what they are doing
and don't need dirty tracking.

Signed-off-by: Ian Campbell <ian.campbell@docker.com>
2017-07-03 10:27:31 +01:00
Ian Campbell
bdd7e7163b pkg: Allow override of commit to calculate hash for show-tag
Useful to answer the question of what the hash was at the point of some older
commit.

$ make --no-print-directory -C pkg/init/ show-tag
linuxkit/init:36c56f0664d49c5a6adc1120d1bf5ba6ac30b389
$ make --no-print-directory -C pkg/init/ show-tag HASH_COMMIT=4699f80ef73141ee87a77d03f93065e541fab382
linuxkit/init:17693d233dd009b2a3a8d23673cb85969e1dce80

Signed-off-by: Ian Campbell <ian.campbell@docker.com>
2017-07-03 10:27:31 +01:00
Vincent Demeester
a315e0b681 Fix DIRS find command to work on more system
Signed-off-by: Vincent Demeester <vincent@sbr.pm>
2017-07-03 10:27:31 +01:00
Ian Campbell
1ea64d33f0 pkg: use Jessie-era compatible git command for calculating $(HASH)
The current rune for $(HASH) returns nothing with the Jessie version of git
(2.1.4). Using `--full-tree` works corectly but requires an absolute path (else
it produces e.g. "fatal: ../init: '../init' is outside repository").

Both `ls-tree` and `diff-index` are happy with a full absolute path, which
simplifies things since we can use `$(CURDIR)` directly.

Tested with a dirty `pkg/init` on both Jessie (git 2.1.4) and Stretch (git
2.11.0) with the following command, which produces identical output in both
cases:

$ for pkg in init containerd ; do make -C pkg/$pkg --no-print-directory show-tag; ( cd pkg/$pkg && make show-tag ); done
linuxkit/init:36c56f0664d49c5a6adc1120d1bf5ba6ac30b389-dirty
linuxkit/init:36c56f0664d49c5a6adc1120d1bf5ba6ac30b389-dirty
linuxkit/containerd:1e3e8f207421de8deac8cedc26a138d6b1661a0d
linuxkit/containerd:1e3e8f207421de8deac8cedc26a138d6b1661a0d

Signed-off-by: Ian Campbell <ian.campbell@docker.com>
2017-07-03 10:27:31 +01:00
Ian Campbell
66f9cc134f pkg: Consolidate $(TAG) to be the full tag
Saves lots of repetitions of `$(ORG)/$(IMAGE):$(HASH)$(DIRTY)` throughout the
file.

Signed-off-by: Ian Campbell <ian.campbell@docker.com>
2017-07-03 10:27:31 +01:00
Ian Campbell
4a3d5acb88 pkg: Only consider the package directory itself for dirty tracking.
Since this is what is used in the hash.

Signed-off-by: Ian Campbell <ian.campbell@docker.com>
2017-07-03 10:27:31 +01:00
Ian Campbell
b6728a85e9 pkg: Simplify dirty handling
By setting `DIRTY` to either "-dirty" or "" directly we can simply use
`$(HASH)$(DIRTY)` and avoid make adding a space as it does with `+=`.

For the push check we now block pushing if `$(DIRTY)` is non-empty.

Signed-off-by: Ian Campbell <ian.campbell@docker.com>
2017-07-03 10:27:31 +01:00
Ian Campbell
55f537631a pkg: add target to print the tag
$ make --no-print-directory -C pkg/init/ show-tag
linuxkit/init:36c56f0664d49c5a6adc1120d1bf5ba6ac30b389

Useful for scripting etc.

Signed-off-by: Ian Campbell <ian.campbell@docker.com>
2017-07-03 10:27:31 +01:00
Rolf Neugebauer
a148a8aa45 pkg: Fix docker-ce package
As of commit b2439251dd ("blueprints: update docker-for-mac.yml
to latest vpnkit packages") the docker-ce package does not need
the vpnkit-expose-port binary anymore. It was also removed from
the linuxkit/vpnkit-forwarder forwarder package with commit
f48a2bfe12 ("pkg: update vpnkit-forwarder") causing the docker-ce
package build to fail.

This commit fixes this by removing the linuxkit/vpnkit-forwarder
package from the docker-ce package build.

Signed-off-by: Rolf Neugebauer <rolf.neugebauer@docker.com>
2017-07-01 19:24:16 +01:00
Rolf Neugebauer
4c1a45957e pkg: Add NETWORK to audit and rngd packages
This fixes a regression introduced in:
5a225b9d ("Makefile: Fix bug where network was not disabled")

Signed-off-by: Rolf Neugebauer <rolf.neugebauer@docker.com>
2017-07-01 18:11:45 +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
Magnus Skjegstad
f48a2bfe12 pkg: update vpnkit-forwarder
Update to latest commit and don't include the binaries that are now in
vpnkit-expose-port.

Signed-off-by: Magnus Skjegstad <magnus@skjegstad.com>
2017-06-30 19:26:47 +02:00
Magnus Skjegstad
6c83b98a40 pkg: add vpnkit-expose-port
This package contains vpnkit binaries needed inside the dockerd
container that can be either copied into the container with a multistage
build or used as an init-container and bind-mounted to the right
locations.

vpnkit-expose-port is a userland proxy that interacts with vpnkit and
the vpnkit-forwarder service to open ports on the host.

vpnkit-iptables-wrapper wraps iptables to launch
vpnkit-expose-port automatically when ports are opened to a swarm
service.

Signed-off-by: Magnus Skjegstad <magnus@skjegstad.com>
2017-06-30 19:26:02 +02: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
736713dc8f Merge pull request #2120 from dave-tucker/getty
Make it more obvious that getty/sshd are namespaced
2017-06-29 23:30:17 +01:00
Justin Cormack
fed24c4110 Update to Docker 17.06.0-ce
Note that the location of the static binaries changed.

Signed-off-by: Justin Cormack <justin.cormack@docker.com>
2017-06-29 15:27:34 +01:00
Dave Tucker
5fb025824f getty: Make namespacing more obvious
Warn the user in the MOTD
Add "(ns: getty)" or "(ns: sshd)" to the PS1
Use `agetty` and `-a root` to ensure we get a login shell when insecure

Signed-off-by: Dave Tucker <dt@docker.com>
2017-06-29 14:58:44 +01:00
Tycho Andersen
740b97cc90 auditd: update image hash
Riyaz has actually pushed this hash, so let's use it.

Signed-off-by: Tycho Andersen <tycho@docker.com>
2017-06-28 16:44:54 -06:00
Tycho Andersen
b95e28f466 auditd: add missing build.sh file
Whoops :)

Signed-off-by: Tycho Andersen <tycho@docker.com>
2017-06-28 16:25:46 -06:00
Tycho Andersen
44cbd38650 add an auditd container
Two things to note here: we unfortunately can't just exec audit, because
something needs to load the rules in beforehand.

Second, it also dies if it can't re-nice itself, so we have to give it
CAP_SYS_NICE as well as the audit caps.

I didn't add this to the default linuxkit.yml because the linuxkit/audit
repo doesn't exist yet, but we should probably (?) do that. Additionally,
we should provide the kernel parameter audit=1, otherwise according to
auditd's man pages, we can't audit some early tasks.

Closes #52

Signed-off-by: Tycho Andersen <tycho@docker.com>
2017-06-28 09:15:51 -06:00
Riyaz Faizullabhoy
ec7f1df1b4 Merge pull request #2112 from djs55/trim-after-delete2
RFC: add "trim after image delete" to the Docker for Mac blueprint
2017-06-27 14:12:00 -07:00
Rolf Neugebauer
093dae22d5 Update YAML files
- Use the new style kernel tags with the full kernel version
- Update packages with new alpine base and new/simplified Makefiles.

Signed-off-by: Rolf Neugebauer <rolf.neugebauer@docker.com>
2017-06-27 19:56:08 +01:00
Rolf Neugebauer
2fb65e8f1e doc: Remove explicit hashes from documentation in ./pkg
People typically update hashes in YAML files with
'git grep ... | sed ...' this will change the README.md files
in the ./pkg directory and thus change the git tree hash.

Remove the use of explicit hashes from those files to avoid
the obvious chicken and egg problem.

Signed-off-by: Rolf Neugebauer <rolf.neugebauer@docker.com>
2017-06-27 18:01:48 +01:00
David Scott
38787b1ddd Add pkg/trim-after-delete
This adds a helper which monitors the Docker event stream and, when it
receives an image delete event, queues a call to `fstrim /var/lib/docker`
to trigger a space reclamation. Previously we would rely on a cron job
running every 15 minutes.

Signed-off-by: David Scott <dave.scott@docker.com>
2017-06-27 17:55:42 +01:00
Rolf Neugebauer
56d94318d9 pkg: Use curl instead of ADD to fetch rng-tools
There seems to be a change in docker 17.06-rc5 on how remote
URLs and tar archives work with ADD. Use curl instead.

Signed-off-by: Rolf Neugebauer <rolf.neugebauer@docker.com>
2017-06-27 17:43:58 +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
da24542d78 pkg: Improve package build
- Only build if the hash has changed. Previosuly
  we'd unconditionally build and not push of the tag existed.
- Add '.m' to the hash if the repository is dirty.
  This allows developers to build locally without committing
  but makes it clear that the hash is from a modified repository.
- Don't push to hub if the repository is dirty
- If the current commit has a tag, also push this to hub.

Signed-off-by: Rolf Neugebauer <rolf.neugebauer@docker.com>
2017-06-27 17:43:57 +01:00
Riyaz Faizullabhoy
ac80cd2574 Merge pull request #2101 from furious-luke/master
Add a metadata provider for Vultr
2017-06-26 14:59:21 -07:00
Ian Campbell
bbbbf3cb5d sshd: sync bind mounts with getty container
This adds all the binds from pkg/getty/Dockerfile to pkg/sshd/Dockerfile and
retains the existing /root/.ssh and /etc/resolv.conf binds.

With this `dist` and `ctr` function in a ssh session.

Signed-off-by: Ian Campbell <ian.campbell@docker.com>
2017-06-26 11:52:41 +01:00
Ian Campbell
2864f467b9 getty,sshd: Include ca-certificates.
Otherwise:

    dist pull docker.io/library/redis:alpine
    dist: failed to do request: Head https://registry-1.docker.io/v2/library/redis/manifests/alpine: x509: failed to load system roots and no roots provided

Signed-off-by: Ian Campbell <ian.campbell@docker.com>
2017-06-26 11:52:41 +01:00
Ian Campbell
34fbe42615 getty,sshd: Mount host /tmp into containers.
ctr (which runs in the getty or ssh container) relies on sharing files in /tmp
with containerd (which runs in the host mount namespace). Specifically it
currently uses paths under /tmp/containerd for the stdio FIFOs of containers, resulting in:

    # ctr run -t docker.io/library/redis:alpine test
    ctr: rpc error: code = Unknown desc = runtime create failed: runc create failed: container with id exists: test

Currently it is not possible to specify a non-existent source directory for a
bind mount, so we cannot easily bind just /tmp/containerd. Sharing all of /tmp
doesn't sound like a terrible idea anyway.

Defering updating the sha in *.yml until after some further changes to these packages.

Signed-off-by: Ian Campbell <ian.campbell@docker.com>
2017-06-26 11:52:41 +01:00
Ian Campbell
ea79748830 pkg/containerd: Add /etc/localtime set to UTC
containerd/ctr includes this in the default set of bind mounts for a container.

Signed-off-by: Ian Campbell <ian.campbell@docker.com>
2017-06-26 11:52:30 +01:00
Luke Hodkinson
3dc23b96ac Add a metadata provider for Vultr
Vultr uses a very similar approach to AWS, including using the
same IP address for serving metadata. In fact, it seems
as though if AWS appears first in the list of providers, that
provider mistakenly believes to be running on AWS (hence the
insertion of `NewVultr` in between GCP and AWS. I don't believe
AWS servers will accidentally try to use the Vultr provider,
as it seems that the `/v1/` endpoint doesn't exist on AWS.

Signed-off-by: Luke Hodkinson <furious.luke@gmail.com>
2017-06-24 07:43:07 +10: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
Akihiro Suda
4699f80ef7 test: add test-containerd
Signed-off-by: Akihiro Suda <suda.akihiro@lab.ntt.co.jp>
Signed-off-by: Rolf Neugebauer <rolf.neugebauer@docker.com>
2017-06-19 11:04:58 -07:00
Ian Campbell
9d2da9cabc Update to containerd c215531a8f63a98a69134e804fea4ee6d354bb90
This includes https://github.com/containerd/containerd/pull/994 and hence
requires updating the various instances of `/etc/containerd/config.toml`.

Signed-off-by: Ian Campbell <ian.campbell@docker.com>
2017-06-16 13:42:24 +01: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
Ian Campbell
f7b2a739ee pkg/getty: Stop bind mounting /tmp/ctr
This doesn't exist with newer ctr or in systems where service containers are
not started using the ctr tool. All it contains today are the stdio FIFOs,
which are not in general useful to access after container creation.

Signed-off-by: Ian Campbell <ian.campbell@docker.com>
2017-06-16 11:21:40 +01:00
Justin Cormack
684b77d62b Merge pull request #2048 from MagnusS/vpnkit-docker-ce
pkg/docker-ce: add vpnkit-expose-port
2017-06-15 15:18:54 -07:00
Magnus Skjegstad
e3a25bbf5b pkg/docker-ce: add vpnkit-expose-port
vpnkit-expose-port is the dockerd userland proxy used to expose
forwarding ports with vpnkit. This adds the binary to the image in
/usr/bin/vpnkit-expose-port, but does not enable it by default.

Signed-off-by: Magnus Skjegstad <magnus@skjegstad.com>
2017-06-15 19:48:30 +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
Riyaz Faizullabhoy
6dedac2fe9 Update getty image for setsid changes
Signed-off-by: Riyaz Faizullabhoy <riyaz.faizullabhoy@docker.com>
2017-06-15 09:16:12 -07:00
Justin Cormack
7cf06bb284 Merge pull request #2038 from rn/cold-plug
Support cold-plugging devices
2017-06-15 18:07:17 +02:00
Avi Deitcher
42bf54de28 copy setsid to setsidu so it does not get overwritten by busybox when used in init, and ensure inittab is clean
Signed-off-by: Avi Deitcher <avi@deitcher.net>
2017-06-14 13:22:18 +03: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
Riyaz Faizullabhoy
35977c53d6 Merge pull request #2022 from justincormack/sys-in-getty
mount /sys in getty container and add and fix kernel tests
2017-06-12 09:29:44 -07:00
Magnus Skjegstad
24ec30e74c vpnkit-forwarder: add /pkg/vpnkit-forwarder
Adds /pkg/vpnkit-forwarder which downloads and builds vpnkit-forwarder
and vpnkit-expose-port from moby/vpnkit. Also includes an example for
forwarding `sshd` and updates the documentation for `hyperkit` to
include a `vpnkit` section.

`vpnkit` still requires a 9P mount for coordination, so the `socat`
forwarding is simpler to set up at the moment.

Signed-off-by: Magnus Skjegstad <magnus@skjegstad.com>
2017-06-12 14:46:48 +01:00
Justin Cormack
19b3beff9f Mount system /sys into getty container
Without this the mounts underneath here were not visible.

fix #2019

Signed-off-by: Justin Cormack <justin.cormack@docker.com>
2017-06-12 10:44:14 +02:00
Ken Cochrane
7dafc3be01 Added more AWS metadata to /var/config
Signed-off-by: Ken Cochrane <kencochrane@gmail.com>
2017-06-10 10:54:43 -04:00
Riyaz Faizullabhoy
8726adaa78 s/moby/linuxkit for run
Signed-off-by: Riyaz Faizullabhoy <riyaz.faizullabhoy@docker.com>
2017-06-08 17:10:14 -07:00
Riyaz Faizullabhoy
9c8e82734d fix disk size arg
Signed-off-by: Riyaz Faizullabhoy <riyaz.faizullabhoy@docker.com>
2017-06-08 17:09:52 -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
Justin Cormack
e0dc6302a8 Merge pull request #1978 from deitch/gettyless-init
Remove all getty from init
2017-06-08 15:33:21 +01:00
Justin Cormack
513f661458 Clean up getty Makefile to match others
Signed-off-by: Justin Cormack <justin.cormack@docker.com>
2017-06-08 11:02:48 +01:00
Riyaz Faizullabhoy
33d66d380e Merge pull request #1994 from tych0/fix-pkg-builds
fix package builds in some cases
2017-06-07 17:49:32 -07:00
Justin Cormack
9b82914f7d Run make tag on pkg directory to check packages build
This at least checks for buildability of packages, even if we
are not yet pushing them.

See https://github.com/linuxkit/linuxkit/issues/1991 for what it mitigates.
Will not pass until this is fixed.

Signed-off-by: Justin Cormack <justin.cormack@docker.com>
2017-06-07 16:37:36 -06:00
Tycho Andersen
cf9397786c fix up second rngd containerd->alpine typo
Signed-off-by: Tycho Andersen <tycho@docker.com>
2017-06-07 16:36:38 -06:00
Tycho Andersen
a208413ac0 fix package builds in some cases
0eb21735ae accidentally broke some package
builds by switching linuxkit/alpine to linuxkit/containerd. Let's revert
the ones that shouldn't be there.

Closes #1991

Signed-off-by: Tycho Andersen <tycho@docker.com>
2017-06-07 16:19:40 -06:00
Justin Cormack
09e6ff2e34 Merge pull request #1977 from deitch/console-login
Add getty pkg
2017-06-07 23:15:47 +01:00
Avi Deitcher
5db7e6fe69 Add getty pkg
Signed-off-by: Avi Deitcher <avi@deitcher.net>
2017-06-08 00:11:53 +03:00
Riyaz Faizullabhoy
efbeea75d0 Merge pull request #1951 from dave-tucker/ports
Test that no ports are open
2017-06-07 11:30:13 -07:00
Dave Tucker
1af1a20a0d containerd: Don't expose metrics by default
This can be turned on if required but we'll default to leaving it off
It's been enabled in the top-level linuxkit.yml
This port is also non-standard and there doesn't appear to be a standard
port for this as yet.

Signed-off-by: Dave Tucker <dt@docker.com>
2017-06-07 15:18:13 +01: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
Rolf Neugebauer
0c1498d8fa docs: Update platform documentation
- Prefix platform documentation with 'platform-'
- Add/Correct links from top-level README.md
- Tweak the Azure documentation
- Move the vsudd README to platform-hyperkit.md
- Add a dummy document for qemu/kvm

Signed-off-by: Rolf Neugebauer <rolf.neugebauer@docker.com>
2017-06-07 13:39:41 +01:00
Ian Campbell
0eb21735ae Update to containerd bdf9f5f7388e8203e63a74b89800f7f3dd4a7743
Note that this is not the latest (which was 95efd45db073 at time of writing)
but the next commit 6428b4bad0c2 merges "Port ctr to use client package" breaks
the use of `ctr run --runtime-config` (by removing that option).

This contains https://github.com/containerd/containerd/pull/954 which was
causing some services to fail to start.

All previous uses of 15541037b9 are updated to
5749f2e9e6.

Signed-off-by: Ian Campbell <ian.campbell@docker.com>
2017-06-07 09:38:10 +01:00
Justin Cormack
ad7770fbf9 Update containerd
Fixes boltdb copying issue which caused failures.

Signed-off-by: Justin Cormack <justin.cormack@docker.com>
2017-06-06 22:10:12 +01:00
Magnus Skjegstad
ae56dd81c2 vsudd: add /pkg/vsudd with README and example yml
Signed-off-by: Magnus Skjegstad <magnus@skjegstad.com>
2017-06-06 16:32:01 +01:00
Ken Cochrane
60d099176c Added AWS provider to metadata package
Signed-off-by: Ken Cochrane <kencochrane@gmail.com>
2017-06-01 16:44:58 -04:00
Justin Cormack
ad1d33255d Change mkimage to use two disks
Signed-off-by: Justin Cormack <justin.cormack@docker.com>
2017-06-01 14:41:32 +01:00
Ian Campbell
eaedbd454c Update containerd to 7fc91b05917e93d474fab9465547d44eacd10ce3
Update everything including the current
linuxkit/containerd:b1766e4c4c09f63ac4925a6e4612852a93f7e73b to the new
linuxkit/containerd:deaf5bf838bf7f131c2287ecff3ed9835b0497e2.

Signed-off-by: Ian Campbell <ian.campbell@docker.com>
2017-05-31 17:05:24 +01:00
Justin Cormack
5bb90f166a Merge pull request #1934 from justincormack/default-ns-change
Default ns change
2017-05-30 16:20:38 +01:00
Rolf Neugebauer
8cbf7cb064 Merge pull request #1883 from ijc25/qemu-ga
Add a simple qemu guest agent package
2017-05-30 16:15:55 +01:00
Justin Cormack
d92e19f020 Update the yaml files with new builds
Signed-off-by: Justin Cormack <justin.cormack@docker.com>
2017-05-30 15:40:51 +01:00
Justin Cormack
d9aada88dc Update for new default namespaces
See https://github.com/moby/tool/pull/56

Signed-off-by: Justin Cormack <justin.cormack@docker.com>
2017-05-30 15:06:30 +01: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
Ian Campbell
497b07e57b Add a simple qemu guest agent package
We don't actually build it here, we just use the alpine package, which is
already included in the linuxkit/alpine base.

Can be instantiated with a service stanza such as:
  - name: qemu-ga
    image: "linuxkit/qemu-ga:e5fbcf55926f6e1a96b3e49a392e547e8be1022c"
    binds:
      - /dev/vport0p1:/dev/vport0p1

The only functionality I've tested is to report IP addresses to the host (e.g.
via `virsh domifaddr`).

The image is configured to use `/dev/vport0p1` by default. If your VM image is
using a different port number then you can either incorporate the rename into
the bind ("/dev/vport1p1:/dev/vport0p1") or override the command with:
    command: ["/usr/bin/qemu-ga", "-p", "/dev/vport1p1"]

The mdev tool appears to not create the symlinks which udev would provide
`/dev/virtio-ports/org.qemu.guest_agent.0` hence the need to hardcode the
potentially unstable `/dev/vportNp1`, `N` seems to depend on the number and
order of virtio devices in use. I don't know if it is possible to get mdev to
create these links. For reference the udev rule is:

    SUBSYSTEM=="virtio-ports", KERNEL=="vport*", ATTR{name}=="?*", SYMLINK+="virtio-ports/$attr{name}"

See https://wiki.libvirt.org/page/Qemu_guest_agent for more info on the guest
agent.

A suitable stanza is added to `projects/swarmd/swarmd.yml` since that is where
I am using it.

Signed-off-by: Ian Campbell <ian.campbell@docker.com>
2017-05-30 13:59:35 +01:00
Rolf Neugebauer
ebc7bd181a pkg: Update the binfmt packages to use the Alpine base compiling
Signed-off-by: Rolf Neugebauer <rolf.neugebauer@docker.com>
2017-05-29 17:30:57 +01:00
Rolf Neugebauer
6d59041daa pkg: Update the metadata package to multi-stage build and alpine base
- Use the alpine base to compile the go program
- Use a multi-stage build

Signed-off-by: Rolf Neugebauer <rolf.neugebauer@docker.com>
2017-05-29 17:30:57 +01:00
Riyaz Faizullabhoy
cdd27f7758 Update other ymls with linuxkit org after signing off on all packages
Signed-off-by: Riyaz Faizullabhoy <riyaz.faizullabhoy@docker.com>
2017-05-26 14:50:49 -07:00
Rolf Neugebauer
37c5e6bffb pkg: Update open-vm-tools to new Alpine base
Signed-off-by: Rolf Neugebauer <rolf.neugebauer@docker.com>
2017-05-26 16:23:56 +01:00
Rolf Neugebauer
86a6635930 docs: Update documentation
Signed-off-by: Rolf Neugebauer <rolf.neugebauer@docker.com>
2017-05-26 16:23:56 +01:00
Rolf Neugebauer
157c07be15 pkg: Add config label to the swap package
Note this also removes 'net:host' and 'pid:host' as
this does not seem to be necessary.

Also update to latest Alpine base image.

Signed-off-by: Rolf Neugebauer <rolf.neugebauer@docker.com>
2017-05-26 16:21:12 +01:00
Rolf Neugebauer
fbbfd7a1fe pkg: Add config label to the sshd package
Also update to latest Alpine base image.

Signed-off-by: Rolf Neugebauer <rolf.neugebauer@docker.com>
2017-05-26 16:21:12 +01:00
Rolf Neugebauer
27c573ed2c pkg: Add config label to the node_exporter package
Signed-off-by: Rolf Neugebauer <rolf.neugebauer@docker.com>
2017-05-26 15:50:54 +01:00
Rolf Neugebauer
330ccdf0e2 pkg: Add config label to the openntpd package
Also update to latest Alpine base image.

Signed-off-by: Rolf Neugebauer <rolf.neugebauer@docker.com>
2017-05-26 15:50:54 +01:00
Rolf Neugebauer
3aac2416ad pkg: Add config label to the mount package
Also update to latest Alpine base image.

Signed-off-by: Rolf Neugebauer <rolf.neugebauer@docker.com>
2017-05-26 15:50:54 +01:00
Rolf Neugebauer
5484035af5 pkg: Add config label to the format package
Also update to latest Alpine base image.

Signed-off-by: Rolf Neugebauer <rolf.neugebauer@docker.com>
2017-05-26 15:50:54 +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
Justin Cormack
a1d96f23a9 Merge pull request #1898 from thebsdbox/open-vm-tools
open-vm-tools package
2017-05-26 15:32:01 +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
thebsdbox
58829874d1 open-vm-tools package/documentation
Signed-off-by: Dan Finneran <daniel.finneran@gmail.com>
2017-05-25 16:15:15 +01:00
Justin Cormack
b46084695f Add a mkimage package
This will replace the tools/mkimage-* Docker images.

Signed-off-by: Justin Cormack <justin.cormack@docker.com>
2017-05-25 13:57:48 +01:00
Rolf Neugebauer
3dda372640 pkg: Add moby config label to the rngd package
While at it, also update the Alpine base to a newer version.

Signed-off-by: Rolf Neugebauer <rolf.neugebauer@docker.com>
2017-05-23 15:55:40 +01:00
Rolf Neugebauer
5cbd2d1a9a pkg: Add moby config label to binfmt package
While at it also update to the newer Alpine base image

Signed-off-by: Rolf Neugebauer <rolf.neugebauer@docker.com>
2017-05-23 15:55:33 +01:00
Rolf Neugebauer
b9172f2dd6 pkg: Add moby config label to dhcpcd package
This specifies the capabilities and bind mounts the dhcpcd daemon
needs.

While at it also update the Alpine base image

Signed-off-by: Rolf Neugebauer <rolf.neugebauer@docker.com>
2017-05-23 15:55:33 +01:00
Rolf Neugebauer
a6d834ddf0 Merge pull request #1865 from justincormack/go-compile
more Go compile fixes
2017-05-21 11:18:45 +01:00
Rolf Neugebauer
4377ae3209 Merge pull request #1861 from justincormack/containerd-build
Update containerd
2017-05-21 11:13:07 +01:00
Justin Cormack
f7cc10890d Update sysfs in line with sysctl
Signed-off-by: Justin Cormack <justin.cormack@docker.com>
2017-05-20 11:05:59 +01:00
Justin Cormack
e4d7e0b90c Update alpine for sysctl, remove gitignore
Minor cleanup

Signed-off-by: Justin Cormack <justin.cormack@docker.com>
2017-05-20 11:02:12 +01:00
Justin Cormack
4b30328c74 Add label to sysctl image
Signed-off-by: Justin Cormack <justin.cormack@docker.com>
2017-05-19 22:05:15 +01:00
Justin Cormack
e12b5a36ba Convert sysctl to using linuxkit/alpine and nested build
Signed-off-by: Justin Cormack <justin.cormack@docker.com>
2017-05-19 14:23:06 +01:00
Justin Cormack
c6e5ff83e0 Update containerd
- use new Makefile flags to add our build flags correctly now
- restore `dist` for now as it is useful for testing still, for now

Will remove both `dist` and `ctr` once we have our own tool, but will add
them to dev container instead.

Signed-off-by: Justin Cormack <justin.cormack@docker.com>
2017-05-19 11:51:13 +01:00
Rolf Neugebauer
6bea56c185 Update all YAML files to use the new packages
Signed-off-by: Rolf Neugebauer <rolf.neugebauer@docker.com>
2017-05-18 18:55:22 +01:00
Rolf Neugebauer
d2c32e2e38 pkg: Make Hub org/repository build time configurable
Update the Makefiles of the remaining packages.

Signed-off-by: Rolf Neugebauer <rolf.neugebauer@docker.com>
2017-05-18 18:55:22 +01:00
Rolf Neugebauer
ab5bb75642 pkg: Use tini from alpine base in rngd
This makes the package slightly bigger as tini from Alpine
is not statically linked but removes the dependency on
./tools/tini

Signed-off-by: Rolf Neugebauer <rolf.neugebauer@docker.com>
2017-05-18 18:55:22 +01:00
Rolf Neugebauer
e950d6e2ac pkg: Roll the sshd package from linuxkit/alpine
Also convert it to a multi-stage build and 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
Rolf Neugebauer
9f6578783b pkg: Roll the swap package from linuxkit/alpine
Also convert to a multi-stage build and make the
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
Rolf Neugebauer
add7b63276 pkg: Roll the openntpd package from linuxkit/alpine
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
Rolf Neugebauer
7270e125d4 pkg: Roll the mount package from linuxkit/alpine
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
Rolf Neugebauer
e255bf1bf5 pkg: Roll the format package from linuxkit/alpine
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
Rolf Neugebauer
f5024e4baf pkg: Roll the docker-ce package from linuxkit/alpine
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
Rolf Neugebauer
92b8d873bf pkg: Roll the dhcpcd package from linuxkit/alpine
The dhcpcd package only needs a basic alpine-baselayout and
dhcpcd. This reduces the size of the package from 4.3MB to 1.8MB.

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
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
Rolf Neugebauer
c1a873b489 pkg: Update most packages to new alpine base
Also make the HUB org/registry build time configurable
for these packages.

Others will be reworked in sub sequent commits.

Signed-off-by: Rolf Neugebauer <rolf.neugebauer@docker.com>
2017-05-18 18:55:22 +01:00
Ian Campbell
5eee4c0607 pkg/runc: WORKDIR as first item in second stage
Works around https://github.com/moby/moby/issues/33176 and fixes #1807.

Updated al users of linuxkit/runc:2649198589ef0020d99f613adaeda45ce0093a38 to
this new build.

Signed-off-by: Ian Campbell <ian.campbell@docker.com>
2017-05-12 19:23:27 +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
716f60f226 Update containerd
This includes the bug fix that was causing output to be lost much
of the time.

fix #1660

Signed-off-by: Justin Cormack <justin.cormack@docker.com>
2017-05-11 10:11:18 +01:00
Ian Campbell
800badea42 metadata: Allow simple string keys
If a file is a simple string (as opposed to a map) then write it with the
default perms. This makes for slightly terser metadata when creating a simple
datafile.

Signed-off-by: Ian Campbell <ian.campbell@docker.com>
2017-05-11 01:39:03 +01:00
Ian Campbell
8fd1a3cbdb metadata: Fix parsing of JSON
`ok` was not assigned when type casting to `map[string]interface{}` so the
subsequent check was testing a stale value.

Also, the error message upon failure had the wrong sense.

Signed-off-by: Ian Campbell <ian.campbell@docker.com>
2017-05-10 17:37:45 +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
Justin Cormack
9e879dc56a Update Docker to 17.05.0-ce
This includes nested build support so we can look at starting to dogfood.

Signed-off-by: Justin Cormack <justin.cormack@docker.com>
2017-05-09 11:08:16 +01:00
Justin Cormack
61bbbf0808 Change containerd and runc to use multistage builds from new Alpine base
Signed-off-by: Justin Cormack <justin.cormack@docker.com>
2017-05-08 22:37:59 +01:00
Justin Cormack
b70ca67931 Remove dist tool from containerd
It is 20MB and we don't use it...

Signed-off-by: Justin Cormack <justin.cormack@docker.com>
2017-05-08 21:12:12 +01:00
Justin Cormack
c73f9b3e6b Update containerd
My patch has been merged so may as well use upstream.

Signed-off-by: Justin Cormack <justin.cormack@docker.com>
2017-05-08 21:10:54 +01:00
Rolf Neugebauer
725853f11d Update packages/tests to use the new tini package
Signed-off-by: Rolf Neugebauer <rolf.neugebauer@docker.com>
2017-05-08 16:46:47 +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
Rolf Neugebauer
41b7861bac pkg: Remove c-compile from rgnd
Directly install the required packages from the Alpine base
image to compile the rngd package.

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:28:39 +01:00
Rolf Neugebauer
98a8be0087 pkg: Update packages to new version of the alpine base image
Signed-off-by: Rolf Neugebauer <rolf.neugebauer@docker.com>
2017-05-08 16:28:39 +01:00
Rolf Neugebauer
17adcefe6c pkg: Convert openntpd to use the Alpine base image and git tree hash
Signed-off-by: Rolf Neugebauer <rolf.neugebauer@docker.com>
2017-05-04 22:27:59 +01:00
Rolf Neugebauer
41a1d16694 pkg: Use git tree hash for the prometheus node_exporter
Signed-off-by: Rolf Neugebauer <rolf.neugebauer@docker.com>
2017-05-04 22:27:59 +01:00
Rolf Neugebauer
1748a69f2a pkg: Convert mount to use the Alpine base and git tree hash
Signed-off-by: Rolf Neugebauer <rolf.neugebauer@docker.com>
2017-05-04 22:27:59 +01:00
Rolf Neugebauer
fce13fb48d pkg: Convert format to use the Alpine base and git tree hash
Signed-off-by: Rolf Neugebauer <rolf.neugebauer@docker.com>
2017-05-04 22:27:59 +01:00
Rolf Neugebauer
43d97967ef pkg: Convert docker-ce to use the Alpine base and git tree hash
Signed-off-by: Rolf Neugebauer <rolf.neugebauer@docker.com>
2017-05-04 22:27:59 +01:00
Rolf Neugebauer
e929205c31 pkg: Convert dhcpcd to use the Alpine base image and git tree hash
This builds the dhcpcd package from a fixed Alpine 3.5 base and adds
the dhcpcd daemon from the Alpine base image. This should make the
build reproducible and allows us to use the git tree hash.

Signed-off-by: Rolf Neugebauer <rolf.neugebauer@docker.com>
2017-05-04 22:27:59 +01:00
Rolf Neugebauer
aea6d6c54e pkg: Convert binfmt to use the Alpine base image and git tree hash
Signed-off-by: Rolf Neugebauer <rolf.neugebauer@docker.com>
2017-05-04 22:27:59 +01:00
Justin Cormack
26f7d6ebdd Update ca-certificates to use new Alpine base image
This is what the other images should look like in future.

Signed-off-by: Justin Cormack <justin.cormack@docker.com>
2017-05-03 16:42:28 +01:00
Justin Cormack
a37fd19f88 Adjust docker-ce package
Bring it into line with official images: remove `jq`, `sfdisk` which
are not needed; we used them for disk mounting but this is down standalone.
Add the tools for other filesystems, which are needed for `dm`, `btrfs`.

Signed-off-by: Justin Cormack <justin.cormack@docker.com>
2017-05-02 14:37:04 +01:00
Avi Deitcher
aebd255755 Add support for encrypted swap
Update examples/swap.yml to use latest linuxkit/swap image
Add comment to examples/swap.yml how to enable encryption
Add encrypt options to README
Make encrypted swap the default

Signed-off-by: Avi Deitcher <avi@deitcher.net>
2017-04-30 11:07:56 +03:00
Avi Deitcher
f72a2e7bef use updated kernel and correct path in examples/swap.yml
for swap.sh, take any command-line options, not just those with an arg
that in turn requires a new hash on the example

Use latest 4.9.x kernel to keep in line with other examples

Replace (bash) herestring with (posix) heredoc in swap.sh, and update hash to match

Signed-off-by: Avi Deitcher <avi@deitcher.net>
2017-04-29 22:18:42 +03: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
Riyaz Faizullabhoy
2c4c55859f Add separate sign-tag target, keep tool building offline
Signed-off-by: Riyaz Faizullabhoy <riyaz.faizullabhoy@docker.com>
2017-04-27 10:34:40 -07: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
Justin Cormack
1cd201aac5 Merge pull request #1715 from deitch/swap-module
First cut of swap image and example
2017-04-26 21:47:54 +01:00
Avi Deitcher
715cfbd02c First cut of swap image and example
Signed-off-by: Avi Deitcher <avi@deitcher.net>

Fix spaces after commas

Remove MAINTAINER

Signed-off-by: Avi Deitcher <avi@deitcher.net>

Simplify swap.yml example to remove files section

Signed-off-by: Avi Deitcher <avi@deitcher.net>

Switch swap.sh to sh from bash and remove bash from image

Signed-off-by: Avi Deitcher <avi@deitcher.net>

Replace fallocate with dd and update calculation function to support it

Signed-off-by: Avi Deitcher <avi@deitcher.net>

Fix indentation

Signed-off-by: Avi Deitcher <avi@deitcher.net>

Change link to swap to just swap.sh

Signed-off-by: Avi Deitcher <avi@deitcher.net>

Fix indent

Signed-off-by: Avi Deitcher <avi@deitcher.net>
2017-04-26 23:05:45 +03: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
Riyaz Faizullabhoy
72e7945ec6 Add signing targets for binfmt, c-compile, go-compile, rngd, tini, toybox-media
Signed-off-by: Riyaz Faizullabhoy <riyaz.faizullabhoy@docker.com>
2017-04-26 10:55:20 -07:00
Justin Cormack
713046e158 Update ca-certificates to be based on Alpine and use nested build
We were using Debian but Alpine more consistent. Use nested build.

Currently extract the hash in a nasty way but this can be fixed later
when we switch over hashing method.

Signed-off-by: Justin Cormack <justin.cormack@docker.com>
2017-04-26 15:24:26 +01:00
Justin Cormack
98159fd13f Merge pull request #1708 from rneugeba/binfmt
Move binfmt to a multi-stage build
2017-04-26 12:19:09 +01:00
Rolf Neugebauer
c6416ddecb pkg: Use multi-stage builds for the binfmt package
Signed-off-by: Rolf Neugebauer <rolf.neugebauer@docker.com>
2017-04-25 14:54:54 +01: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
Rolf Neugebauer
8d1eb49fa7 pkg: Convert rngd to a multi-stage build
This allows us to get rid of the ./base/rng-tools

Use c-compile to compile it

Signed-off-by: Rolf Neugebauer <rolf.neugebauer@docker.com>
2017-04-24 18:41:27 +01:00
Rolf Neugebauer
85bcee93dd tools: Move tini to ./tools and convert to multi-stage build
Previously the "tini" contained the entire build. Using the
multi-stage build creates a new "tini" base image, which only
contains the "/bin/tini". This image can be used as the base
image for packages requiring "tini".

Signed-off-by: Rolf Neugebauer <rolf.neugebauer@docker.com>
2017-04-24 18:41:27 +01:00
Justin Cormack
d616cea3e1 Enable Prometheus metrics on port 13337 on containerd
Signed-off-by: Justin Cormack <justin.cormack@docker.com>
2017-04-16 10:43:44 -05:00
Rolf Neugebauer
856a2651b0 pkg: Add a Prometheus node_exporter package
Signed-off-by: Rolf Neugebauer <rolf.neugebauer@docker.com>
2017-04-16 09:43:40 -05: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
Riyaz Faizullabhoy
3d91a7be86 Bump go-compile with ineffassign
Signed-off-by: Riyaz Faizullabhoy <riyaz.faizullabhoy@docker.com>
2017-04-12 16:54:51 -07: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
e7314ff350 pkg: Use images from 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
Rolf Neugebauer
a06e6bbb37 build: Switch using go-compile from linuxkit hub org
Signed-off-by: Rolf Neugebauer <rolf.neugebauer@docker.com>
2017-04-12 21:28:17 +01:00
Rolf Neugebauer
105cb48ad6 metadata: Simplify the GCP SSH code
Signed-off-by: Rolf Neugebauer <rolf.neugebauer@docker.com>
2017-04-12 16:19:24 +01:00
Rolf Neugebauer
432bdda272 pkg: Remove metadata-gcp
It's no longer used

Signed-off-by: Rolf Neugebauer <rolf.neugebauer@docker.com>
2017-04-12 15:42:48 +01:00
Rolf Neugebauer
a21c566777 metadata: Make sure the ssh directory exists before writing to it
Signed-off-by: Rolf Neugebauer <rolf.neugebauer@docker.com>
2017-04-12 15:39:08 +01:00
Rolf Neugebauer
ce52c28cf6 metadata: Write the provider to /var/config/provider
This will be useful for testing.

Signed-off-by: Rolf Neugebauer <rolf.neugebauer@docker.com>
2017-04-12 15:39:08 +01:00
Rolf Neugebauer
b0a0b4ceb7 metadata: Make JSON parser more robust
Make sure the type conversions are OK.

Signed-off-by: Rolf Neugebauer <rolf.neugebauer@docker.com>
2017-04-12 15:39:08 +01:00
Rolf Neugebauer
626f02def2 metadata: Improve logging
Implementing a String() interface for each provider makes it
easier for users to prefix log strings with the provider.

Signed-off-by: Rolf Neugebauer <rolf.neugebauer@docker.com>
2017-04-12 15:39:08 +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
Rolf Neugebauer
9cf63a4aaa Merge pull request #1584 from rneugeba/userdata
pkg: Add a generic metadata package
2017-04-11 15:45:34 +01:00
Rolf Neugebauer
766e1d95d3 pkg: Add a generic metadata package
This package handles meta and user data for different cloud
and other platforms. It should be easy to extend to new
platforms.

Currently, it handles GCP metadata and a simple CDROM userdata
provider.

Signed-off-by: Rolf Neugebauer <rolf.neugebauer@docker.com>
2017-04-11 15:32:17 +01:00
Justin Cormack
2c7628c101 Support dhcpcd in one shot mode as well
This is needed for cloud environments that want to get their metadata in
the onboot phase over the network.

Signed-off-by: Justin Cormack <justin.cormack@docker.com>
2017-04-11 14:58:57 +01:00
Justin Cormack
a3ec9e86df Add openntpd container
Added to Docker example as Swarm mode likes time sync.

Note uses pool.ntp.org at present, on some providers it
should use a different source.

Constraints not enabled as they seem to have an issue;
possibly trying to set before network is up.

Signed-off-by: Justin Cormack <justin.cormack@docker.com>
2017-04-10 20:32:59 +01:00
Justin Cormack
3afe494ae9 Merge pull request #1567 from justincormack/sysfs
Add a sysfs container and fix memory hierarchy
2017-04-10 17:59:37 +01:00
Justin Cormack
bc23fde1c2 Use the real default containerd toml config
Rather than an empty one.

Signed-off-by: Justin Cormack <justin.cormack@docker.com>
2017-04-10 16:25:13 +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
efd1efe531 Add a sysfs container
However, do not try to change memory cgroups from it; this needs to be in `init`.

Signed-off-by: Justin Cormack <justin.cormack@docker.com>
2017-04-10 14:33:38 +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
3ffa912c41 Move mount back to its own package, not inside docker
Signed-off-by: Justin Cormack <justin.cormack@docker.com>
2017-04-09 12:53:46 +01:00
Justin Cormack
e0aced6be0 Merge pull request #1550 from justincormack/rootfs-mountpoint
Make each rootfs a mountpoint by binding
2017-04-09 09:52:23 +01:00
Justin Cormack
fb5d6a8fad Add an (empty) config file for containerd
It needs one now.

Signed-off-by: Justin Cormack <justin.cormack@docker.com>
2017-04-08 21:38:31 +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
Ilya Dmitrichenko
a3638a2b8f Make sshd example usefull for debugging
Signed-off-by: Ilya Dmitrichenko <errordeveloper@gmail.com>
2017-04-08 12:49:51 +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
Justin Cormack
485452d9bd Merge pull request #1460 from justincormack/automount
Add a formatting container and persistent disk support for docker
2017-04-06 16:08:20 +01:00
Justin Cormack
0a030dc219 Clean up dhcpcd container
It is not necessary to bring up `eth0`, the program does it fine.

This means we can remove shell script, clean up build.

Signed-off-by: Justin Cormack <justin.cormack@docker.com>
2017-04-06 15:32:22 +01:00
Justin Cormack
cf7b952995 Add persistent drive support to Docker container
This works and runs containers now, if you eg `runc exec` into it.
Needs a few tweaks for rlimits, but will pull and run containers.

Will integrate better with ssh/dev containers to make more usable.

For a simple test use
```
./bin/moby build examples/docker.yml
./bin/moby run hyperkit -disk-size 100 docker

```

Signed-off-by: Justin Cormack <justin.cormack@docker.com>
2017-04-06 14:25:42 +01:00
Justin Cormack
8bcb2c9e0e Add a formatting container
This is based on the code we used for Docker Editions, and
will format an external drive, to be used for example for
`/var` for Docker image persistence.

It does not `mount` the drive yet, as splitting format and mount
gives better modularity.

Example yaml fragment:
```
  - name: format
    image: "mobylinux/format:097d4f22b20f976b1f89d8f0b8a5d074d35b856c"
    binds:
     - /dev:/dev
    capabilities:
     - CAP_SYS_ADMIN
     - CAP_MKNOD
```

Signed-off-by: Justin Cormack <justin.cormack@docker.com>
2017-04-06 13:19:46 +01: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
Justin Cormack
e643f4a454 Move Go code to src/cmd
This does not get everything where we want it finally, see #1266
nor the optimal way of building, but it gets it out of top level.

Added instructions to build if you have a Go installation.

Not moving `vendor` yet.

Signed-off-by: Justin Cormack <justin.cormack@docker.com>
2017-03-21 14:37:23 +00:00
Justin Cormack
159202416c Out with the old, in with the new Moby
- remove remainder of editions code
- add a new check container to run tests without Docker
- switch over `make test` to use new command to build tests

Signed-off-by: Justin Cormack <justin.cormack@docker.com>
2017-03-06 22:28:41 +00:00
Justin Cormack
4797088ec0 Rough first version of the moby tool
- terrible code
- lots needs changing
- can build a Moby from a config yaml that boots

Signed-off-by: Justin Cormack <justin.cormack@docker.com>
2017-02-20 21:44:23 +00:00