Skip to content

Instantly share code, notes, and snippets.

View deviantony's full-sized avatar

Anthony Lapenna deviantony

View GitHub Profile
deviantony /
Last active July 10, 2024 00:52
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 July 7, 2024 01:37
Portainer HTTP API by example


This gist is now deprecated in favor of our official documentation: which contains up to date examples!


Please refer to the link above to get access to our updated API documentation and examples.

deviantony /
Created March 8, 2018 01:24
Portainer admin password in a docker-compose environment

Portainer compose deployment with admin password preset

This file aims to explain how to deploy Portainer inside a compose file with the admin password already set.

Generate the admin password

For this example, we'll use the password superpassword.

Use the following command to generate a hash for the password:

deviantony /
Last active January 6, 2024 18:04
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 / gist:ddb93425dc6f011c4d8b
Created September 13, 2015 15:20
SH entrypoint for docker-compose to manage dependency startup.
#!/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 / docker-compose.yml
Created September 5, 2017 13:19
Docker Swarm cluster setup with Docker in Docker
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 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
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 /
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 / phantomjs
Last active January 4, 2018 17:18 — forked from wbotelhos/
Installer script to setup phantomjs 1.9.7, it will remove any previous setup. Contains also the init script to manage phantomjs as a system service and the default configuration file. Tested on Ubuntu 12.04.
#! /bin/sh
# Init. script for phantomjs, based on Ubuntu 12.04 skeleton.
# Author: Anthony Lapenna <>
DESC="Phantomjs service"