coreos-kvm
is a container images which runs a QEMU/KVM CoreOS VM.
Run the container image as a privileged container. Provide Ignition or Cloud-Config user-data to provision the guest instance.
# config
sudo docker run --name kvm --privileged -e CONFIG_FILE=/userdata/config.yaml -v $PWD/examples/config.yaml:/userdata/config.yaml quay.io/dghubble/coreos-kvm
# ignition
sudo docker run --name kvm --privileged -e IGNITION_CONFIG_FILE=/userdata/ignition.json -v $PWD/examples/ignition.json:/userdata/ignition.json quay.io/dghubble/coreos-kvm
# cloud-config
sudo docker run --name kvm --privileged -e CLOUD_CONFIG_FILE=/userdata/cloud.yaml -v $PWD/examples/cloud.yaml:/userdata/cloud.yaml quay.io/dghubble/coreos-kvm
SSH into the container IP on port 2222.
sudo docker network inspect bridge
ssh -p 2222 [email protected]
The container runs a local port (2222) forward to the CoreOS VM (22).
env variable | example |
---|---|
CONFIG_FILE | /userdata/config.yaml |
IGNITION_CONFIG_FILE | /userdata/ignition.json |
CLOUD_CONFIG_FILE | /userdata/cloud.yaml |
VM_NAME | coreos-kvm |
VM_MEMORY | 4G |
VM_DISK_SIZE | 12G |
HOSTFWD | hostfwd=tcp::2222-:22 |
To develop the container image, build it locally.
Build the container image.
make docker-image
Run the container image as a privileged container. Provide Ignition or Cloud-Config user-data to provision the guest instance.
# config
sudo docker run --name kvm --privileged -e CONFIG_FILE=/userdata/config.yaml -v $PWD/examples/config.yaml:/userdata/config.yaml dghubble/coreos-kvm
# ignition
sudo docker run --name kvm --privileged -e IGNITION_CONFIG_FILE=/userdata/ignition.json -v $PWD/examples/ignition.json:/userdata/ignition.json dghubble/coreos-kvm
# cloud-config
sudo docker run --name kvm --privileged -e CLOUD_CONFIG_FILE=/userdata/cloud.yaml -v $PWD/examples/cloud.yaml:/userdata/cloud.yaml dghubble/coreos-kvm
Remove the container from another terminal.
sudo docker stop kvm
sudo docker rm kvm