Skip to main content

How to - Creating a data container

A data container is the read/write database engine that you connect to for working with your databases. All data containers are based off a data image, providing you access to any databases and data in the original image, but taking just seconds to create. All data containers that you create are isolated from any others, allowing you or your team members to make changes without worrying about impacting anything else.

Spawn is currently in open beta. Complete the installation instructions to get access.

This is part of a series of short guides for getting up and running quickly with Spawn.

Data image graphic

Create a data container#

Similar to Docker, a data container is created based on a data image. To create a data container in this example, you should have already created a data image named dev.

To create the data container, we simply run a spawnctl command referencing our data image using the --image parameter.

spawnctl create data-container --image dev

Connecting to your data container#

Once the data container has been created successfully, the command will return with both the container name (auto generated if not specified) and a connection string. You can use this connection string in an application that needs to connect to the database, or use the values such as Host,Port,Username and Password to connect to your data container using your usual client tools.

Data container 'dev-uxhdaoap' created!
-> Host=instances.spawn.cc;Port=xxxxx;Username=xxxx;Database=postgres;Password=xxxxxxxxx

Seeing your data containers#

View all your data containers using the following command.

spawnctl get data-containers
ID Name Revision Status Engine CreatedAt
00001 dev-cxmwgjeo rev.0 Completed PostgreSQL 15 minutes ago
00002 dev-eukjbnkm rev.0 Completed PostgreSQL 10 minutes ago
00003 dev-uchdwpkp rev.0 Completed PostgreSQL 7 minutes ago

If you need the connection string again for a data container, add -o wide.

spawnctl get data-containers -o wide

To return your data containers, including connection details in a format more suitable for parsing programmatically, add -o json

spawnctl get data-containers -o json

Using your data container#

Now you are able to create data containers, you can perform advanced actions such as save, graduate, reset and load.