mirror of
https://github.com/linuxkit/linuxkit.git
synced 2025-12-25 04:15:16 +00:00
The previous version just created a network name space which does not allow us to also test additional namespaces, e.g. for unix domain sockets. This commit uses runc to create a fully namespaced container to run a test in. It creates a container, configures the network interfaces in the new network namespace before starting the container. A OCI config.json template is used and then customised for a given test based on command line arguments. Finally, instead of iperf, we use the socket stress test from https://github.com/linuxkit/virtsock as it provides finer-grained control over the traffic patterns (e.g. long lived vs lots of short lived connections). Signed-off-by: Rolf Neugebauer <rolf.neugebauer@docker.com>
31 lines
1.1 KiB
Docker
31 lines
1.1 KiB
Docker
FROM linuxkit/alpine:34af9cb1990debd17fae6d4198c62ce3910d9908 AS mirror
|
|
RUN mkdir -p /out/etc/apk && cp -r /etc/apk/* /out/etc/apk/
|
|
RUN apk add --no-cache --initdb -p /out \
|
|
alpine-baselayout \
|
|
busybox \
|
|
iproute2 \
|
|
jq \
|
|
musl
|
|
RUN rm -rf /out/etc/apk /out/lib/apk /out/var/cache
|
|
|
|
FROM linuxkit/alpine:34af9cb1990debd17fae6d4198c62ce3910d9908 AS build
|
|
RUN apk add --no-cache \
|
|
build-base \
|
|
git \
|
|
go \
|
|
musl-dev
|
|
ENV GOPATH=/go PATH=$PATH:/go/bin
|
|
ENV VIRTSOCK_COMMIT=0416e3d85541e7a067fd000c69f50997b5d47c93
|
|
RUN git clone https://github.com/linuxkit/virtsock.git /go/src/github.com/linuxkit/virtsock && \
|
|
cd /go/src/github.com/linuxkit/virtsock && \
|
|
git checkout $VIRTSOCK_COMMIT && \
|
|
make bin/sock_stress.linux
|
|
|
|
|
|
FROM scratch
|
|
COPY --from=mirror /out/ /
|
|
COPY --from=build /go/src/github.com/linuxkit/virtsock/bin/sock_stress.linux /rootfs/sock_stress
|
|
COPY config.template.json *.sh /
|
|
|
|
LABEL org.mobyproject.config='{"pid": "host", "net":"host", "binds": ["/dev:/dev","/sys:/sys", "/usr/bin/runc:/usr/bin/runc"], "capabilities": ["all"]}'
|