tests: reenable linuxkit.packages.containerd

The newest tests actually run containerd and therefore have some additional
requirements:
- containerd + shim + runc binaries are needed. We bind these in from the host.
  The test code should, by design, be from matching containerd source, assuming
  we remember to update test/pkg/container/Dockerfile when we bump
  CONTAINERD_COMMIT.  5217b9973b added a reminder
  to do so.
- the tests need networking (to pull images). So add dhcp to onboot and bind
  /etc/resolv.conf into the test container.
- running containers requires a writeable cgroup mount.
- containerd wants /etc/localtime, so install the UTC one (as we do in
  pkg/containerd).

The test image already has `net: host` and `capabilities: all`.

Signed-off-by: Ian Campbell <ijc@docker.com>
This commit is contained in:
Ian Campbell 2017-07-27 11:39:49 +01:00
parent 017d3304fc
commit 88ab788749
3 changed files with 9 additions and 5 deletions

View File

@ -7,13 +7,15 @@ init:
- linuxkit/containerd:8fc87b7f465bde9ece781899a007f47b6d3c096b
- linuxkit/ca-certificates:67acf038c44bb191ebb704ec7bb39a1524052cdf
onboot:
- name: dhcpcd
image: linuxkit/dhcpcd:17423c1ccced74e3c005fd80486e8177841fe02b
command: ["/sbin/dhcpcd", "--nobackground", "-f", "/dhcpcd.conf", "-1"]
- name: sysctl
image: linuxkit/sysctl:d1a43c7c91e92374766f962dc8534cf9508756b0
- name: test
image: linuxkit/test-containerd:0e350ce958b379b9ddb2bcdd22aaf4508f6ddbc3
image: linuxkit/test-containerd:dd3f2ba599c70994ba875e7c86c04df2967e3144
- name: poweroff
image: linuxkit/poweroff:3845c4d64d47a1ea367806be5547e44594b0fa91
trust:
org:
- linuxkit

View File

@ -1,6 +1,6 @@
#!/bin/sh
# SUMMARY: Run containerd test
# LABELS: skip
# LABELS:
# REPEAT:
set -e

View File

@ -14,8 +14,10 @@ RUN apk add --no-cache --initdb -p /out \
linux-headers \
make \
musl \
util-linux
util-linux \
tzdata
RUN rm -rf /out/etc/apk /out/lib/apk /out/var/cache
RUN cp /out/usr/share/zoneinfo/UTC /out/etc/localtime
FROM scratch
COPY --from=mirror /out/ /
@ -29,4 +31,4 @@ RUN git checkout $CONTAINERD_COMMIT
ADD run.sh ./run.sh
ENTRYPOINT ["/bin/sh", "run.sh"]
LABEL org.mobyproject.config='{"net": "host", "capabilities": ["all"], "tmpfs": ["/tmp:exec"], "binds": ["/dev:/dev"]}'
LABEL org.mobyproject.config='{"net": "host", "capabilities": ["all"], "tmpfs": ["/tmp:exec"], "binds": ["/dev:/dev", "/etc/resolv.conf:/etc/resolv.conf", "/usr/bin/runc:/usr/bin/runc", "/usr/bin/containerd:/usr/bin/containerd", "/usr/bin/containerd-shim:/usr/bin/containerd-shim"], "mounts": [{"type": "cgroup", "options": ["rw","nosuid","noexec","nodev","relatime"]}],}'