0.3.4 • Published 2 years ago

emagiz-portainer-api-client v0.3.4

Weekly downloads
-
License
MIT
Repository
-
Last release
2 years ago

Portainer API client

Example: Copy image to local registry

const portainerUrl = 'http://localhost:9000/api'
const portainerUsername = 'admin'
const portainerPassword = 'password'
const registryUrl = 'localhost:5000'
const registryUsername = ''
const registryPassword = ''
const endpointName = 'local-edge-agent'

const portainer = new PortainerClient(portainerUrl)
await portainer.authorize(portainerUsername, portainerPassword)
portainer.addRegistry(registryUrl, registryUsername, registryPassword)

await portainer.pullImage(endpointName, 'openjdk:8-jre-alpine')
await portainer.tagImage(endpointName, 'openjdk:8-jre-alpine', registryUrl + '/mirror/openjdk:8-jre-alpine')
await portainer.pushImage(endpointName, registryUrl + '/mirror/openjdk:8-jre-alpine')
await portainer.deleteImage(endpointName, registryUrl + '/mirror/openjdk:8-jre-alpine', true)

Example: Deploy a stack using compose

var compose = {
  version: '3.3',
  services: {
    service: {
      image: 'mysql',
      environment: { MYSQL_ALLOW_EMPTY_PASSWORD: 'true' },
      ports:['3306:3306']
    }
  }
}
await portainer.deployStack(endpointName, "mysql", dump(compose)) // import dump from ys-yaml

Example: Deploy a stack using compose

await portainer.deleteStack(endpointName, "mysql")

Known issues

  • createContainer method does not work on most recent Portainer versions
0.3.4

2 years ago

0.3.3

2 years ago

0.3.0

2 years ago

0.3.2

2 years ago

0.3.1

2 years ago

0.2.2

3 years ago

0.2.1

3 years ago

0.2.0

3 years ago

0.1.0

4 years ago

0.0.6

4 years ago

0.0.5

4 years ago

0.0.4

4 years ago

0.0.3

4 years ago

0.0.1

4 years ago

0.0.2

4 years ago