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 <justin.cormack@docker.com>
This commit is contained in:
Justin Cormack 2017-09-21 14:50:27 -07:00
parent cc200d296a
commit b52fcb71a1
3 changed files with 8 additions and 4 deletions

View File

@ -30,10 +30,10 @@ To build it with the latest Docker CE:
$ moby build -name docker-for-mac base.yml docker-ce.yml $ 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): 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):

View File

@ -24,6 +24,10 @@ onboot:
- name: mount - name: mount
image: linuxkit/mount:4fe245efb01384e42622c36302e13e386bbaeb08 image: linuxkit/mount:4fe245efb01384e42622c36302e13e386bbaeb08
command: ["/usr/bin/mountie", "/var/lib"] 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 # mount-vpnkit mounts the 9p share used by vpnkit to coordinate port forwarding
- name: mount-vpnkit - name: mount-vpnkit
image: alpine:3.6 image: alpine:3.6

View File

@ -9,10 +9,10 @@ Normally, unless you are running explicitly in a desktop version, LinuxKit image
onboot: onboot:
- name: swap - name: swap
image: linuxkit/swap:<hash> image: linuxkit/swap:<hash>
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. * `/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 * `/dev` to `/dev` so it can do the right thing for devices