Skip to main content

create data-image

Overview#

In order for Spawn to create a database to work against, you'll first need to create a data image.

For more information about data images please see data image concepts

Lifetime#

You can specify a lifetime for a data image via the lifetime flag. This will automatically delete your data image after the time specified, in time duration format (number followed by a unit suffix. Valid units are "h", "m", "s").

If no value is provided, your data image will have an unlimited lifetime, and will only be deleted if you explicitly request it.

If there are data containers running for the expired data image, the data image will not be removed

You can update data images after creation to alter their lifetime

Command#

spawnctl create data-image -f ./development.yaml

To override any Tags specified in the yaml file, use the --tag option.

spawnctl create data-image -f ./development.yaml --tag v1.0

To override the name specified in the .yaml file, use the --name option.

spawnctl create data-image -f ./development.yaml --name new-name

To create a data-image with a lifetime define it in the .yaml file or use --lifetime option

spawnctl create data-image -f ./development.yaml --lifetime 48h

Tutorial#

In this tutorial we will create a data image.

As a prerequisite you should've followed the instructions to install spawnctl

  1. Create a file development.yaml with your data image specifications.

    sourceType: empty
    name: dev
    engine: postgresql
    version: 11.0

    In this case we want to create a PostgreSQL data image that is completely empty and is named dev.

    Interested in other engines? Go to our data image page to see how you can use other engines we support.

  2. Run the following command to create a data image.

    $ spawnctl create data-image -f ./development.yaml
    Data image 'dev' (10001) created!
  3. You can verify your data image by running the following command.

    $ spawnctl get data-images
    NAME IMAGE ID ENGINE STATUS MESSAGE CREATED
    dev 10001 PostgreSQL 2 Created 2 minutes ago