mirror of
https://github.com/linuxkit/linuxkit.git
synced 2025-12-02 08:23:05 +00:00
Compile Moby for AWS (Amazon Machine Image)
Requirements
To compile, the requirements are:
- Must be working on a EC2 instance
- Must have
dockeranddocker-composeinstalled - Must have configured Amazon credentials on instances (
aws configure)
(The build will mount ~/.aws into the build container).
Building
To bake the AMI:
$ make ami
Inside of the alpine/ subdirectory of the main Moby repo.
This will:
- Clean up any remaining artifacts of old AMI builds
- Creates a new EBS volume and attaches it to the build instance
- Formats and partitions the volume for installation of Linux
- Sets up artifacts (
initrd.imgandvmlinuz64) inside the new partition for booting - Installs MBR to boot syslinux to the device
- Takes snapshot of EBS volume with Moby installed
- Turns the snapshot into an AMI
Testing
Once the AMI has been created a file, aws/ami_id.out will be written which
contains its ID.
You can boot a small AWS instance from this AMI using the aws/run-instance.sh
script.
There is no SSH available today, but inbound access on the Docker API should work if you configure a proper security group and attach it to the instance.
For instance, allow inbound access on :2375 and a command such as this from
your compiler instance should work to get a "root-like" shell:
$ docker -H 172.31.2.176:2375 \
run -ti \
--privileged \
-v /:/hostfs \
alpine:3.4 \
chroot /hostfs