https://github.com/s8sg/firecracker-go-template
Builds firecracker filesystem with provided Go application
https://github.com/s8sg/firecracker-go-template
firecracker firecracker-go firecracker-microvms golang unikernel
Last synced: 11 months ago
JSON representation
Builds firecracker filesystem with provided Go application
- Host: GitHub
- URL: https://github.com/s8sg/firecracker-go-template
- Owner: s8sg
- License: apache-2.0
- Created: 2019-01-15T04:23:20.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2019-01-16T06:29:18.000Z (over 7 years ago)
- Last Synced: 2025-07-05T02:45:03.399Z (12 months ago)
- Topics: firecracker, firecracker-go, firecracker-microvms, golang, unikernel
- Language: Shell
- Homepage:
- Size: 13.7 KB
- Stars: 12
- Watchers: 2
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# firecracker-go-template
Builds firecracker filesystem with provided Go application
> This repository is a direct copy and edit on **UNIK's firecracker compiler**
> For more details on UNIK click [here](https://github.com/solo-io/unik)
## Getting Started
**Prerequisites**
```text
docker
firecracker
firectl
```
**Get firecracker kernel**
```bash
curl -fsSL -o /tmp/hello-vmlinux.bin https://s3.amazonaws.com/spec.ccfc.min/img/hello/kernel/hello-vmlinux.bin
```
**Setup tap interface - Optional for network**
```bash
sudo ip tuntap add tap0 mode tap # user $(id -u) group $(id -g)
sudo ip addr add 172.20.0.1/24 dev tap0
sudo ip link set tap0 up
```
Set your main interface device. If you have different name check it with ifconfig command
```bash
DEVICE_NAME=eth0
```
Provide iptables rules to enable packet forwarding
```bash
sudo sh -c "echo 1 > /proc/sys/net/ipv4/ip_forward"
sudo iptables -t nat -A POSTROUTING -o $DEVICE_NAME -j MASQUERADE
sudo iptables -A FORWARD -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT
sudo iptables -A FORWARD -i tap0 -o $DEVICE_NAME -j ACCEPT
```
### Build docker image
```bash
make
```
## Write your simple golang application
##### 1. Write your demo go application
```bash
mkdir demo
cat > demo/main.go < demo/main.go <