diff --git a/Makefile b/Makefile index 357110f90..2fe8c69c3 100644 --- a/Makefile +++ b/Makefile @@ -20,7 +20,7 @@ endif PREFIX?=/usr/local/ -MOBY_COMMIT=4db06aa1732b44a8cadd9c8577df0aa5c716e701 +MOBY_COMMIT=a824287800b1871fde9859f5b2bd9009eaefa990 MOBY_VERSION=0.0 bin/moby: tmp_moby_bin.tar | bin tar xf $< diff --git a/blueprints/README.md b/blueprints/README.md index 21a96ac71..cebbae73a 100644 --- a/blueprints/README.md +++ b/blueprints/README.md @@ -19,6 +19,7 @@ the [examples/](../examples/) directory. - Packet.net - ... + ### Docker for Mac An initial blueprint for the open source components of Docker for Mac is available in [docker-for-mac](docker-for-mac). The blueprint has support for controlling `dockerd` from the host via `vsudd` and port forwarding with VPNKit. It requires HyperKit, VPNKit and a Docker client on the host to run. The easiest way to install these at the moment is to install a recent version of Docker for Mac. @@ -42,3 +43,14 @@ $ docker -H unix://docker-for-mac-state/guest.00000947 ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES ``` +### Linux Containers On Windows (LCOW) + +The [LCOW](./lcow.yml) file contains the blueprint for building a +minimal Linux kernel and initrd for Linux Containers on +Windows. Invoke it with `moby build lcow.yml` and you get a +`lcow-kernel` and `lcow-initrd.img`. Rename `lcow-kernel` to +`bootx64.efi` and `lcow-initrd.img` to `initrd.img` and then +follow +[these instructions](https://github.com/moby/moby/issues/33850). The +process for creating the image is +documented [here](https://github.com/Microsoft/opengcs). diff --git a/blueprints/lcow.yml b/blueprints/lcow.yml new file mode 100644 index 000000000..e2dc12e41 --- /dev/null +++ b/blueprints/lcow.yml @@ -0,0 +1,9 @@ +kernel: + image: linuxkit/kernel:4.11.9 + cmdline: "console=ttyS0" + tar: none +init: + - linuxkit/init-lcow:ae67df4c4cabb35aae06898cb94fe03972a172e9 +trust: + org: + - linuxkit diff --git a/pkg/init-lcow/Dockerfile b/pkg/init-lcow/Dockerfile new file mode 100644 index 000000000..39cb751c8 --- /dev/null +++ b/pkg/init-lcow/Dockerfile @@ -0,0 +1,41 @@ +FROM linuxkit/alpine:3744607156e6b67e3e7d083b15be9e7722215e73 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 \ + e2fsprogs \ + musl +RUN rm -rf /out/etc/apk /out/lib/apk /out/var/cache + +FROM linuxkit/alpine:3744607156e6b67e3e7d083b15be9e7722215e73 AS build +RUN apk add --no-cache build-base curl git go musl-dev +ENV GOPATH=/go PATH=$PATH:/go/bin +ENV OPENGCS_COMMIT=4e4e6f28a03e974e6c32f00a91d51f9605821fdd +RUN git clone https://github.com/Microsoft/opengcs.git /go/src/github.com/Microsoft/opengcs && \ + cd /go/src/github.com/Microsoft/opengcs && \ + git checkout $OPENGCS_COMMIT && \ + cd service && \ + make +RUN mkdir /out && \ + cp -r /go/src/github.com/Microsoft/opengcs/service/bin /out/bin && \ + cp /go/src/github.com/Microsoft/opengcs/kernelconfig/4.11/scripts/init_script /out/init && \ + chmod ugo+rx /out/init && \ + mkdir /out/sbin && \ + curl -fSL "https://raw.githubusercontent.com/mirror/busybox/38d966943f5288bb1f2e7219f50a92753c730b14/examples/udhcp/simple.script" -o /out/sbin/udhcpc_config.script && \ + chmod ugo+rx /out/sbin/udhcpc_config.script && \ + mkdir -p /out/root/integration && \ + cp /go/src/github.com/Microsoft/opengcs/kernelconfig/4.11/prebuildSandbox.vhdx /out/root/integration/prebuildSandbox.vhdx + +# This d line below should be removed once +# https://github.com/Microsoft/opengcs/issues/52 is addressed and then +# runc should be added via the YAML file +FROM linuxkit/runc:a0f2894e50bacbd1ff82be41edff8b8e06e0b161 AS runc + +FROM scratch +ENTRYPOINT [] +CMD [] +WORKDIR / +COPY --from=mirror /out/ / +COPY --from=build /out/ / +COPY --from=runc /usr/bin/runc /sbin/runc + diff --git a/pkg/init-lcow/Makefile b/pkg/init-lcow/Makefile new file mode 100644 index 000000000..64157d26b --- /dev/null +++ b/pkg/init-lcow/Makefile @@ -0,0 +1,4 @@ +IMAGE=init-lcow +NETWORK=1 + +include ../package.mk