With around 2800+ GITHUB stars, 54 contributors, 28 external, 50+ commits per week since the DockerCon launch, LinuxKit has really gained a lot of momentum among the community users. LinuxKit today supports multiple platforms – AWS, Hyper V, Azure, MacOS, Google Cloud Platform, Packets.net, VMware Fusion, QEMU & Local Hypervisors. Installation of LinuxKit on macOS has been simplified using Homebrew. Just 2 simple brew commands and moby is ready to build up your LinuxKit OS image.
Soon after DockerCon 2017, I wrote a blog post on how to get started with LinuxKit for Google Cloud Platform. Since then I have been closely keeping eye on the latest features, enablements & releases of LinuxKit. Under this blog post, I bring up a simplified approach to get LinuxKit OS instance running on top of Amazon Web Services(AWS) Platform.
Here we go..
- Install AWS CLI on macOS(Using Homebrew)
- Installing LinuxKit & Moby Tool(Using Homebrew)
- Configuring AWS S3 bucket
- Building a RAW image with Moby tool
- Configuring VM Import Service Role
- Upload the aws.raw Image to remote AWS S3 bucket using LinuxKit
- Run the LinuxKit OS as EC2 Instance
Installing AWS CLI on macOS
AWS_REGION environment variable as this is used by the AWS Go SDK:
Installing LinuxKit & Moby tool:[simterm]
$brew tap linuxkit/linuxkit
$brew install –HEAD moby
$brew install –HEAD linuxkit[/simterm]
Creating/Configuring AWS S3 bucket:
Open up AWS Management console and click on S3 under AWS Services. It will open up the below page:
Building AWS RAW Image using Moby:
This builds up aws.raw which we need to push to AWS S3 bucket using the below command:[simterm]
$linuxkit push aws -bucket linuxkit-images -timeout 1200 aws.raw[/simterm]
This will throw the below error:
“…The sevice role <vmimport> does not exist or does not have sufficient permissions for the service to continue. status code: 400, request id: 0ce661fb-e9b4-40b8-af07-9da6a6fc3c94..”
Follow the next section to get it fixed..
Configuring VM Import Service Role
VM Import requires a role to perform certain operations in your account, such as downloading disk images from an Amazon S3 bucket. You must create a role named
vmimport with a trust relationship policy document that allows VM Import to assume the role, and you must attach an IAM policy to the role. I used this script to setup everything in a single shot:
Upload the aws.raw Image to remote AWS S3 bucket using LinuxKit
It’s time to push the RAW Image to S3 bucket:[simterm]
$linuxkit push aws -bucket linuxkit-images -timeout 1200 aws.raw
Created AMI: ami-0a81fe65[/simterm]
Creating an instance[simterm]
$linuxkit run aws aws
Created instance i-02b28f9f8eee1dcf2
Instance i-02b28f9f8eee1dcf2 is running
Open up your AWS Management console and you will soon see new instance coming up.
Here you go.. AWS E2 instance running LinuxKit OS is up and running..
Did you find this blog helpful? Feel free to share your experience. Get in touch @ajeetsraina.
If you are looking out for contribution/discussion, join me at Docker Community Slack Channel.
Know more what’s happening with AWS project activities clicking on this link.