graduate data-container
#
OverviewGraduating a data container allows you to create a data image from it. This is useful when you make changes to a data container and want to use its current state as the baseline for future work. A good example of when to use the graduate
command would be when you were able to reproduce a bug and want to share the state of your database with others. You can graduate the data container and share the resulting data image with your team.
#
Command#
TutorialIn this tutorial we will create a data image, then create a data container from that image. We will then make some changes to the database, save them and perform a graduation. This will create a new data image. We will use this image to create a new data container and inspect its current state.
As a prerequisite you should've followed the instructions to install spawnctl
Create a file
development.yaml
with your data image specifications.In this case we want to create a PostgreSQL data image that is completely empty and is named
dev
.Run the following command to create a data image.
You can verify your data image by running the following command.
Create a data container from the newly created data image.
You can verify your data container was properly created by running the following command.
Notice the created data container has revision
rev.0
.You should now be able to connect to your database and execute queries.
In this example we connect to the PostgreSQL data container (database) using psql.
We can now perform a save operation on this data container.
We can now perform a
graduate
operation on this data container.Now that our new changes are saved, we want to make the current state of this data container (database) the baseline for future work.
You can verify the new data image by running the following command.
Notice the name of the new image is
dev-rambbomj-graduate-1
. This is because it was created from the graduation of a data container.You can now create a data container from that image.
Connect to this data container and verify its content.
Notice that the table
customers
we created previously is present. This is because after creating the table, we saved the data container and then graduated. The graduation operation created a new image. All subsequent data containers based on this image will contain a copy of the data.