Merge pull request #2202 from rn/lcow2

Add experimental support for LCOW
This commit is contained in:
Justin Cormack 2017-07-14 16:58:01 +01:00 committed by GitHub
commit 36df256177
5 changed files with 67 additions and 1 deletions

View File

@ -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 $<

View File

@ -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).

9
blueprints/lcow.yml Normal file
View File

@ -0,0 +1,9 @@
kernel:
image: linuxkit/kernel:4.11.9
cmdline: "console=ttyS0"
tar: none
init:
- linuxkit/init-lcow:ae67df4c4cabb35aae06898cb94fe03972a172e9
trust:
org:
- linuxkit

41
pkg/init-lcow/Dockerfile Normal file
View File

@ -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

4
pkg/init-lcow/Makefile Normal file
View File

@ -0,0 +1,4 @@
IMAGE=init-lcow
NETWORK=1
include ../package.mk