Persist state of server in a docker image to deploy to others without my local directory volume
I am trying to create an image of a docker container of my teamcity server instance so that if I were to run that image, all of the build configurations and everything would be automatically on it.
Currently I am using the command line from the docker hub and using volumes to connect to my local machine directory which works. However, this uses my local file directory and I am trying to have it so I can deploy it to other users and have all of the configurations saved in the container image so they don't need to download the files locally.
Please help!
Please sign in to leave a comment.
Hi Cameron,
the projects and build configurations are stored in the data directory: https://www.jetbrains.com/help/teamcity/teamcity-data-directory.html info about existing builds, users and tests is kept in the database. If you are using the internal database, it's also kept in the data directory, but this is not recommended for production purposes. If you are using an external database, its connection details would be on the data directory as well, so if users need to use their own, you would also need to set that up.
With this in mind, you could create an image with teamcity that won't try to mount the data volume, copy your current data volume in, ensure that the permissions are right for the folder, and then save that as the image. Of course, this would have the drawback than then every time the container would be stopped and restarted, any changes to projects and build configurations will not be maintained.
Another option would be to have the Root project be set up to be stored into a repository through the versioned settings feature. By doing that, you wouldn't have all that much into the root project, and changes would be controlled externally but via repository, so no need for deployed instances to have access to your own hard drive. The largest issue would be that initial pulling of the projects would be slower, as teamcity would need to pull the changes from the repositories, compile them into the actual projects/build configurations, and then it would be available for usage.