Skip to main content

Run Octopus Deploy inside of a Docker container

Octopus Deploy is a Continuous Delivery tool (much like Azure DevOps and Jenkins) that allow us to deploy our artifacts and code to infrastructure. This allows us to not only automate our deployments, but to ship quickly to our customers and end-users. Today we're going to learn how to deploy an Octopus Deploy instance to Docker.

1. A machine running Docker
2. The ability to use Windows container

Before you begin, please ensure you switch to Windows containers if you are running Docker on your desktop.

The first thing we'll need to do is configure our .env configuration. This holds our variables that will be passed into our Docker Compose file. Simply name it ".env" and put it in the same directory as your Docker Compose file. Below is what mine looks like:


Once that's saved, I'll start configuring my Docker Compose file. We will need two docker images for this. SQL Express and Octopus. You can absolutely use a SQL server for this if you're running in production. In fact, I highly recommend not running a SQL container unless you have a connection string pointing from your SQL container to an actual database. For example, you can run a MySQL container, but point the containers connection string to an RDS instance (Database Service in Azure). The reason for this is containers are supposed to be ephemeral and are not persistent. For the purposes of this demo, I'm running it in a Dev environment, so a SQL express container is just fine.

version: '2.1'
    image: microsoft/mssql-server-windows-express
      sa_password: "${SA_PASSWORD}"
      ACCEPT_EULA: "Y"
      test: [ "CMD", "sqlcmd", "-U", "sa", "-P", "${SA_PASSWORD}", "-Q", "select 1" ]
      interval: 10s
      retries: 10

Above is where I configure the version of Docker Compose I'm using and where I start my services. My first service is for my database. As you can see I'm pulling the SQL Express image and utilizing my variables that I created in my .env configuration for my DB password.

    image: octopusdeploy/octopusdeploy:latest
      OctopusAdminUsername: "${OCTOPUS_ADMIN_USERNAME}"
      OctopusAdminPassword: "${OCTOPUS_ADMIN_PASSWORD}"
      sqlDbConnectionString: "Server=db,1433;Initial Catalog=Octopus;Persist Security Info=False;User ID=sa;Password=${SA_PASSWORD};MultipleActiveResultSets=False;Connection Timeout=30;"
     - "8081:81"
        condition: service_healthy
    stdin_open: true

Above is for Octopus. Here I specify the Octopus image, set up my connection to MySQL, what ports I want the UI to listen in, my dependencies which is the DB, and service conditionals.

The end state of your Docker Compose file should look like the below screenshot.

We're not ready to run our Octopus deployment. CD (change directory) into the directory where your Docker Compose and .env configurations are.

Now run docker-compose up to initiate the deployment. This could take a little while. Both of the Docker images we're using are pretty large (2-4GB each).

Octopus will now start deploying.

Once you see "Listening for HTTP requests on", you're ready to connect to the UI. Open up a web browser and type in localhost:8081.

I can now successfully log in with my username and password specified in my .env configuration.

You are now ready to start configuring Octopus Deploy.


Popular posts from this blog

Run PowerShell code with Ansible on a Windows Host

Ansible is one of the Configuration Manager kings in the game. With it's easy-to-understand syntax and even easier to use modules, Ansible is certainly a go-to when you're picking what Configuration Management you want to use for your organization. Your question may be "but Ansible is typically on Linux and what happens when I'm in a Windows environment?". Luckily I'm here to tell you that Ansible will still work! I was pleasantly surprised with how easy it is to use Ansible on Windows with a little WinRM magic. Let's get started.

Pre-requisites for this post:
1) WinRM set up to connect to your Windows host from Ansible
2) Ansible set up for Windows Remote Management
3) SSH access to the Ansible host
4) Proper firewall rules to allow WinRM (port 5985) access from your Ansible host to your Windows host
5) Hosts file set up in Ansible that has your IP or hostname of your Windows Server.
6) At least one Linux host running Ansible and one Windows Server host …

Running PowerShell commands in a Dockerfile

As Docker continues to grow we are starting to see the containerization engine more and more on Windows. With the need for containers on Windows, we also need the same automation we get in Linux with Dockerfiles. Today we're going to create a Dockerfile that runs PowerShell cmdlets.
Prerequisites; 1. Docker for Windows
2. A code editor (VSCode preferred)

Let's go ahead and get our Dockerfile set up. Below is the Dockerfile I used for this post.

from MAINTAINER Michael Levan RUN powershell -Command Install-WindowsFeature -Name Web-Server RUN powershell -Command New-Item -Type File -Path C:\ -Name config
As you can see from the above, this is a tiny Dockerfile. What this will do is install the IIS Windows 

Feature and create a new file in C:\ called "config".
You should see something very similar to the below screenshot;

Next let's create a running container out of our image. First we'll need to run docker container ls to

 get o…

DevOps tooling in the Microsoft realm

When I really started to dive into automation and practicing DevOps with specific tooling, there were a few key players. At the time Microsoft was not one of them. They were just starting to embrace the open source world, including the art and practice of DevOps. Since then Microsoft has went all in and the tech giant has made some incredible tooling. Recently I switched to a Microsoft-heavy environment and I love it. I went from AWS/Python/Ansible/Jenkins to Azure/PowerShell/ARM/Azure DevOps. My first programming language was PowerShell so being back in the saddle allowed me to do a full circle between all of the different types of tooling in both worlds. Today I want to share some of that tooling with you.

The first thing I want to talk about is ARM. What is ARM? ARM is a configuration management tool that allows you to perform software-defined-infrastructure. Much like Ansible and Terraform, ARM allows you to define what you want your environment to look like at scale. With ARM, yo…