What is packer?
A:Packer is a free and open source tool for creating golden image for multiple platform from a single source configuration.
Packer works works on json files
What are on Packer json ?
1.builder(required): Builders are components of packer to create machine image
* type
* iso_url (required)
* iso_checksum (required)
* iso_checksum_type (required)
* ssh_username (optional)
* shutdown_command (optional)
* vm_name (optional)
* guest_os_type (optional)
* disk_size (optional)
* http_directory (optional)
* boot_wait (optional)
* boot_command (optional)
* floppy_file (optional)
there are several type of buildfer
builder | 說明 |
---|---|
amazon-ebs | is able to create Amazon AMIs backed by EBS volumes for use in EC2 |
docker | { |
"builders": [{ |
|
"type": |
|
"docker", |
|
"image": |
|
"alpine", |
|
"export_path": |
|
"alpine-basic.tar" |
|
}] |
|
} |
- varaibles (option): such as AWS access and secret key
"variables": {
3.provisioners (options)
"aws_access_key": "{{env `AWS_ACCESS_KEY_ID`}}",
"aws_secret_key": "{{env `AWS_SECRET_ACCESS_KEY`}}",
"region": "us-east-1"
},
4.pos-processors(options)
* type
* override
* virtualbox
* output
Packer commands
查看 example.json 結構
packer inspect example.json
驗證 example.json 語法
packer validate example.json
產生 vm image
沒有留言:
張貼留言