Skip to content

Instantly share code, notes, and snippets.

View deviantony's full-sized avatar

Anthony Lapenna deviantony

View GitHub Profile
deviantony /
Last active March 17, 2022 00:04
Portainer create image from HTTP API

This document aims to help you use the Portainer HTTP API to build a Docker image on a specific environment.


  • A Portainer instance
  • A Portainer user account
  • The environment where you want to build the image created as an endpoint inside the Portainer instance


deviantony /
Created March 8, 2018 01:24
Portainer admin password in a docker-compose environment
deviantony /
Last active May 4, 2022 18:14
Swarm aggregation feature discussion

Cluster of agents

This implementation rely on the fact that the agent is able to auto-discover other agents. Deployed as a global service inside a Swarm cluster, each agent automatically discover the other agents in the cluster and register them.

Portainer can then be plugged on any of these agents (either by using DNS-SRV records ensure high-availability or using the URL to a specific agent). To do so, a user would just need to create a new endpoint and add the IP:PORT to one of the agents in the cluster (or use the Swarm service name to be able to use DNS-SRV records).

The agent would be responsible for the following:

  • Aggregate the data of multiple nodes (list the containers available in the cluster for example)
  • Redirect requests to specific nodes in the cluster (inspect a container on a specific node or create a new secret via a cluster manager for example)
deviantony / docker-compose.yml
Created September 5, 2017 13:19
Docker Swarm cluster setup with Docker in Docker
View docker-compose.yml
version: "2"
image: portainer/portainer:latest
container_name: "portainer-app"
command: -H unix:///var/run/docker.sock
- portainer
- /tmp/manager_run/docker.sock:/var/run/docker.sock
deviantony /
Last active July 31, 2023 13:53
Portainer HTTP API by example
deviantony /
Last active September 12, 2023 14:44
Install latest version of Docker Compose
## Nowadays, simply follow the Compose installation instructions in the official documentation:
# get latest docker compose released tag
COMPOSE_VERSION=$(curl -s | grep 'tag_name' | cut -d\" -f4)
deviantony /
Last active June 21, 2016 22:29
Installation of the local-persist volume driver for docker without sudo
#!/usr/bin/env bash
set -e
# uname -s, uname -m
# Deb 32: Linux i686
# Ubuntu 64: Linux x86_64
# FreeBSD: FreeBSD amd64
deviantony / valigator.conf
Last active December 21, 2015 09:34
Valigator upstart script
View valigator.conf
description "Valigator tool"
author "Anthony Lapenna"
start on runlevel [2345]
stop on runlevel [!2345]
exec /usr/local/bin/valigator --conf /path/to/valigator.yml
deviantony / gist:ddb93425dc6f011c4d8b
Created September 13, 2015 15:20
SH entrypoint for docker-compose to manage dependency startup.
View gist:ddb93425dc6f011c4d8b
#!/usr/bin/env sh
# Wait for a HTTP service to be OK (return code 200) before trying to start another service.
echo "Stalling for SERVICE"
while true; do
status=$(curl --write-out %{http_code} --silent --output /dev/null http://service.domain/endpoint)
echo "Status: ${status}"
if [ "${status}" == "200" ]; then
deviantony /
Last active March 5, 2023 14:51
VMWare Vsphere info in Python using pyvmomi
#!/usr/bin/env python
import pyVmomi
import argparse
import atexit
import itertools
from pyVmomi import vim, vmodl
from pyVim.connect import SmartConnect, Disconnect
import humanize