From b52fcb71a179fc58e91e9857a4a64ca247bed8b3 Mon Sep 17 00:00:00 2001 From: Justin Cormack Date: Thu, 21 Sep 2017 14:50:27 -0700 Subject: [PATCH] Add swap to the Docker for Mac blueprint We always had 1G swap to work better with small memory setups, but this was omitted in the update to LinuxKit. Signed-off-by: Justin Cormack --- blueprints/README.md | 4 ++-- blueprints/docker-for-mac/base.yml | 4 ++++ pkg/swap/README.md | 4 ++-- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/blueprints/README.md b/blueprints/README.md index 87a6d642d..79581db6c 100644 --- a/blueprints/README.md +++ b/blueprints/README.md @@ -30,10 +30,10 @@ To build it with the latest Docker CE: $ moby build -name docker-for-mac base.yml docker-ce.yml ``` -To run the VM with a 500M disk: +To run the VM with a 4G disk: ``` -linuxkit run hyperkit -networking=vpnkit -vsock-ports=2376 -disk size=500M -data ./metadata.json docker-for-mac +linuxkit run hyperkit -networking=vpnkit -vsock-ports=2376 -disk size=4096M -data ./metadata.json docker-for-mac ``` In another terminal you should now be able to access docker via the socket `guest.00000947` in the state directory (`docker-for-mac-state/` by default): diff --git a/blueprints/docker-for-mac/base.yml b/blueprints/docker-for-mac/base.yml index 91b949e01..7c3d40426 100644 --- a/blueprints/docker-for-mac/base.yml +++ b/blueprints/docker-for-mac/base.yml @@ -24,6 +24,10 @@ onboot: - name: mount image: linuxkit/mount:4fe245efb01384e42622c36302e13e386bbaeb08 command: ["/usr/bin/mountie", "/var/lib"] + # make a swap file on the mounted disk + - name: swap + image: linuxkit/swap:3881b1e0fadb7765d2fa85d03563c887ab9335a6 + command: ["/swap.sh", "--path", "/var/lib/swap", "--size", "1024M"] # mount-vpnkit mounts the 9p share used by vpnkit to coordinate port forwarding - name: mount-vpnkit image: alpine:3.6 diff --git a/pkg/swap/README.md b/pkg/swap/README.md index 6da3cb552..dd03b2417 100644 --- a/pkg/swap/README.md +++ b/pkg/swap/README.md @@ -9,10 +9,10 @@ Normally, unless you are running explicitly in a desktop version, LinuxKit image onboot: - name: swap image: linuxkit/swap: - command: ["swap.sh","--path","/var/external/swap","--size","2G"] + command: ["/swap.sh","--path","/var/external/swap","--size","2G"] ``` -Note that you **nust** mount the following: +Note that you **must** mount the following: * `/var` to `/var` so it can place the swapfile in the right location. * `/dev` to `/dev` so it can do the right thing for devices