Docker Registry as Input for Swarm Deploy

I’m trying to deploy services to a Docker swarm by way of a Linux SSH target to a Swarm Manager. I’m trying to use a Docker Registry feed as input at release time to select what image to deploy.

The problem is the Docker registry feed seems to be restricted to the “Run a Docker container” step. That’s not useful in a Swarm and I don’t want to run the app I’m deploying.

Basically I just want to pick the docker image in Octopus from the registry feed at release time, combine that with any environment variables, dynamically generate / alter / pick up the right docker stack / compose file(s), and then execute a docker stack deploy against that stack over a Linux SSH connection to a Swarm manager node.

Is this possible in Octopus and if so how would I go about it? If not what other alternatives might generate similar results?

I suppose I could modify our build to create and push NuGet packages with a file inside corresponding to the registry image details but that’s an unnecessary duplicate feed at that point. Or I could have the build generate the stack file(s) as package artifacts to Octo but then that’s effectively environment specific builds in CI/CD that I’d prefer to avoid.

Or I suppose a dynamic variable could prompt the user for an image label override but they could type in a bad value etc. so that also doesn’t seem ideal.

Thanks

Hi Geoff,

Thanks for reaching out. I see that you are looking to so something that we haven’t quite built into Octopus just yet. In order to get the result you’re chasing, you may have to build a step yourself.

You should start by looking at the Community Step templates and see if there is anything that will help you get started: https://octopus.com/docs/deployment-process/steps/community-step-templates
You can access the code from the community step templates, which will often speed up your solution development. Additionally, the swarm documentation is great. https://docs.docker.com/engine/swarm/swarm-tutorial/create-swarm/

If you feel like this is something that should be supported natively by Octopus, our roadmaps are often shaped by entries that get a lot of attention within the Octopus uservoice: https://octopusdeploy.uservoice.com/

Otherwise, if you start developing the community step, feel free to reach out further if you get stuck or need some guidance.

I hope this helps,

Regards,

Dane.

Thanks @dane.falvo. That doesn’t really help but thanks for confirming.

I don’t think Swarm support itself should be an expectation from Octopus. However I would expect Docker registry feeds to be first class citizens like Octopus built-in package feeds are and not be coupled and limited to the Docker run in container step.

As it stands I have to generate Octopus packages with stack files pointing to Docker images pushed to a registry and consume that from Octopus but that provides a tighter coupling to the release from the build process. It’s also unnecessary to have to have a registry feed + nuget feed with packages mirroring / pointing to the registry.

Thanks Geoff,

I’m sorry the answer wasn’t exactly what you were after. I am happy to help if you get stuck while developing your step.

I reached out to some engineers and have paraphrased the response they gave me regarding your current solution:

You could do this with a script step using additional package references to docker images. You would either save the YAML (I assume docker swarm has YAML files) via powershell using “Set-Content” or have the template files ready to go in a package with the appropriate octostache templates.

It also wouldn’t hurt to add something to https://octopusdeploy.uservoice.com/ as well.

Regards,

Dane

This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.