Can I run Snappy Ubuntu Core as a guest inside Docker?

Yes, you can: Snappy is just a stripped down version of Ubuntu, and Ubuntu works inside Docker. The fact that Snappy does not appear inside the public Docker repository implies that you have to do things manually.

  1. First, get the latest image:

    wget http://cdimage.ubuntu.com/ubuntu-core/preview/ubuntu-core-alpha-02_amd64-virt.img
    

    This file is a QCOW2 image meant for QEMU/KVM, but we can extract its contents for Docker too.

  2. In order to access the files inside a QCOW2 image, you'll need qemu-nbd, so install it and run:

    qemu-nbd -c /dev/nbd0 ubuntu-core-alpha-02_amd64-virt.img
    

    This command will create a "virtual disk" named /dev/ndb0, with "virtual partitions" named /dev/ndb0pX. Use fdisk -l /dev/nbd0 to get an idea of what partitions are inside the QCOW2 image.

  3. The partition you are interested in is /dev/ndb0p3, so mount it:

    mount /dev/ndb0p3 /somewhere
    
  4. You are almost done! Just follow Docker's guide on custom base images:

    tar -C /somewhere -c . | docker import - snappy
    

Now you are ready to create your Snappy images on top of that base image. For example, I created a snappy_test image with the xkcd-webserver app installed. Here's the Dockerfile I used:

FROM snappy:latest
RUN snappy install xkcd-webserver
EXPOSE 80