Updating Docker Containers With Ouroboros

Updating Docker Containers With Ouroboros

Ouroboros is an automation engine that updates running Docker containers with the latest image from a specified contaner registry.

The updated containers will preserve all parameters and tags as the previously run container.

version: '3'
    container_name: ouroboros
    hostname: ouroboros
    image: pyouroboros/ouroboros
      - CLEANUP=true
      - INTERVAL=300
      - LOG_LEVEL=info
      - SELF_UPDATE=true
      - IGNORE=mongo influxdb postgres mariadb
      - TZ=America/Chicago
    restart: unless-stopped
      - /var/run/docker.sock:/var/run/docker.sock

Ouroboros is no longer maintained, see more


Updating containers enables :

  • quick and easy patching of security vulnerabilities
  • quick update running applications
  • customization of images to suit business needs

Getting Started with Ouroboros


In this post we have built a simple site visit counter , that saves unique page visits in Redis under the key visits.

The visits key contains the browser user agent and the ip .

The visits counter can be reset by going to the /reset route of the application.


The application architecure is as shown below.

graph LR subgraph docker subgraph app logic-->keys end subgraph redis keys-.->db end subgraph ouroboros update-->notify update-.->logic end end subgraph webhook notify-.->message message end



We’ll be using Slack to manage notifications. Anytime a container is updated we’ll receive a notification in a specified channel.

In this case we’ll configure an incoming webhook. To do so create a free workspace, or use an existing workspace.

Use this link to create a webhook.

Create incoming webhook

Next assign a workspace channel that will be receiving the messages.

Add channel “Assign a channel

You’ll get a webhook channel in the format<TOKENA>/<TOKENB>/<TOKENC> .

Webhook URL

That’s it.

You can add an icon if you need to.


As we’ll be running Ourboros as a Docker container we’ll pass all the environment variables in an ouroboros.env file.

Possible Env variables can be found here


In this sample we’ll be using docker-compose to deploy our service therefore we wrote a docker-compose.yml to deploy our application, and bring up Ouroboros with our desired configurations.

For multiple sockets/hosts set a space separated list of DOCKER_SOCKETS in your environment file. Learn More

Learn how to push your images to Docker registry {% post_link devops-with-bitbucket-pipelines ‘using Bitbucket pipelines’ %}.

Every update will push a notification to Slack, you can disable startup notifcations by setting SKIP_STARTUP_NOTIFICATIONS in the environment file to True.

Slack Notifications


Here’s an interactive tutorial to get you up and running with Ouroboros :

Katacoda scenario