Custom Octopus Tentacle docker container image

I’m trying to build a custom docker image cabable of running the octopus tentacle service and powershell scripts that can use the AWS.Tools powershell modules. Ultimately I want to run this tentacle in ECS.

I’ve tried a few approaches starting from different base images:
FROM mcr.microsoft.com/powershell:7.2-alpine-3.13 as this has powershell already installed and running. I can easily add the AWS.Tools modules. However getting the linux tentacle package installed on to this base is too hard as I need to add too many prereqs (eg bash etc)

FROM amazonlinux:2 . I can install powershell and modules, and it has all the tentacle prereqs. However I don’t know how to have the tentacle installed correctly as the instructions here Linux Tentacle - Octopus Deploy indicate running an interactive configure script and I need to split some installation steps into my Dockerfile vs the initial CMD. I tried to source Dockerfile steps from OctopusTentacle/Dockerfile at main · OctopusDeploy/OctopusTentacle · GitHub but thats not really reusable with the linux installer.

FROM octopusdeploy/tentacle:latest. With this base, I am able to install powershell using the Debian 11 instructions listed here: Installing PowerShell on Debian Linux - PowerShell | Microsoft Learn. I’m then able to install the AWS.Tools modules that I require.

This last image has the most success as it will run and register with my octo server. However it is over 1Gb in size. I am able to run AWS commands in the script task window, but the output contains garbage escape chars. eg Get-EC2Instance in a script task window outputs the following:

e[32;1mGroupNames    : e[0m{} 
October 18th 2022 16:03:45
Info
e[32;1mGroups        : e[0m{} 
October 18th 2022 16:03:45
Info
e[32;1mInstances     : e[0m{DINGSTAG} 
October 18th 2022 16:03:45
Info
e[32;1mOwnerId       : e[0m9013111111111
October 18th 2022 16:03:45
Info
e[32;1mRequesterId   : e[0m 
October 18th 2022 16:03:45
Info
e[32;1mReservationId : e[0mr-0e4f0c7acXXXXXXX
October 18th 2022 16:03:45
Info
e[32;1mGroupNames    : e[0m{} 
October 18th 2022 16:03:45
Info
e[32;1mGroups        : e[0m{} 
October 18th 2022 16:03:45
Info
e[32;1mInstances     : e[0m{DINGSTAG} 
October 18th 2022 16:03:45
Info
e[32;1mOwnerId       : e[0m90137411111111
October 18th 2022 16:03:45
Info
e[32;1mRequesterId   : e[0m 
October 18th 2022 16:03:45
Info
e[32;1mReservationId : e[0mr-02a12fceXXXXXXXX 

So my questions:

  1. Is there a better way to build a smaller custom docker linux tentacle, capable of runing powershell scripts?
  2. If not, is there something I can do to make my current image not mangle all the output?

Sincerely
Pete
Dockerfile (1.6 KB)

Hey @peter_m_mcevoy , thanks for reaching out!

There are a couple of things here worth looking into.

First things first - one of our support engineers mentioned that the output you’re seeing is due to ANSI encoded text, which doesn’t show up correctly in non-interactive terminals. There are a couple of options to deal with this - namely no_color as an environment variable, which is discussed a bit more in depth on this StackOverflow post.

Secondly, image size - I don’t think you’re too far off the mark, although 1GB does feel a little heavy. Doing some totally informal math -

The remaining ~250MB can easily be some integration pieces. If the listed tools above meet your needs, it may be worth trying to add the install instructions from octopusdeploy/workertools and octopusdeploy/awsworkertools onto the existing tentacle image. That should give you exactly what you need, from a known good beginning state.

Hopefully the above helped, looking forward to hearing how things go as you dig in some more!

Thanks for the informative and detailed response to my questions - it’s always a pleasure to deal with Octo support.

I set NO_COLOR and the output started to behave. Perhaps there is something I should be changing in my Dockerfile after I install the powershell package to ensure that $PSStyle is actually correct, but I can live with NO_COLOR globally being set

Regarding image size, you state:

The octopusdeploy/tentacle image by default is roughly ~250MB

But that does not seem to be the case (I wish it was!). This is the output I’m seeing for docker image ls:

REPOSITORY                        TAG       IMAGE ID       CREATED          SIZE
octopusdeploy/tentacle            latest    91124fc816ea   2 weeks ago      789MB

Which does seem very large for an agent service

Sincerely
Pete

Sorry about the lack of clarity! That’s the compressed size, not the extracted size. Given that it’s installing the Tentacle, it makes sense that it bloats it a bit more.

Unfortunately, that leads me to believe that’s largely a function of the size of the Tentacle package itself, meaning there’s likely not many other options to reduce the size.

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