I’m trying to get CI/CD set up for my company and am just unclear on some conceptual bits that I need to put this all together. Any help is appreciated.
When pushing code up to gitlab, I’m using the docker-in-docker approach to build a new docker image which includes the changes to the source code, and I then want to run the image, replacing the existing container representing the previous build.
In my .gitlab-ci.yml, I’ve included the commands to build and run the container, and the pipeline finishes successfully, however the docker container run in that process does not continue running on the host machine after the pipeline has finished as I had expected.
My gitlab-runner is running on the server that I am deploying to, and I had expected the container created during the CI/CD pipeline would survive on the host afterwards. What do I need to change in my approach to end up with a newly minted container on my server when all is said and done?
Do I need to push the new docker image up to the GitLab registry, pull it back down, and launch it via some additional script as detailed here? If so, can anyone give me some insight into what is in that mysterious deploy.sh used in that example?