Files
linuxkit/test/pkg/containerd/Dockerfile
Ian Campbell 88ab788749 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>
2017-07-27 12:06:59 +01:00

35 lines
1.3 KiB
Docker

FROM linuxkit/alpine:cb6a0b2b068d892996ebadae999d9baf6e08be5b AS mirror
RUN mkdir -p /out/etc/apk && cp -r /etc/apk/* /out/etc/apk/
# btrfs-progfs is required for btrfs test (mkfs.btrfs)
# util-linux is required for btrfs test (losetup)
RUN apk add --no-cache --initdb -p /out \
alpine-baselayout \
busybox \
btrfs-progs \
btrfs-progs-dev \
gcc \
git \
go \
libc-dev \
linux-headers \
make \
musl \
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/ /
ENV GOPATH=/go
RUN mkdir -p $GOPATH/src/github.com/containerd && \
cd $GOPATH/src/github.com/containerd && \
git clone https://github.com/containerd/containerd.git
WORKDIR $GOPATH/src/github.com/containerd/containerd
# CONTAINERD_COMMIT is defined in linuxkit/alpine
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", "/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"]}],}'