Home Reference Source
import DockerService from 'docker-deploy/app/Service/DockerService.js'
public class | source

DockerService

Docker API Service.

Static Method Summary

Static Public Methods
public static

List Docker's containers.

public static

create(name: String, composeFile: String): Promise

Create Docker's container from Docker Compose file.

public static

delete(containerId: String): Promise

Delete Docker's container.

public static

events(onMessage: Function): Websocket

Open WebSocket with auth token for reading events of a Docker's daemon.

public static

infos(containerId: String): Promise

Retrieve informations about a Docker's container.

public static

Check if User is already logged.

public static

login(username: String, password: String): Promise

Login User given username and password.

public static

Logout User by removing User's token.

public static

logs(containerId: String, onMessage: Function): Websocket

Open WebSocket with auth token for reading logs of a Docker's container.

public static

restart(containerId: String): Promise

Restart Docker's container.

public static

start(containerId: String): Promise

Start Docker's container.

public static

stop(containerId: String): Promise

Stop Docker's container.

Static Public Methods

public static containers(): Promise source

List Docker's containers.

Return:

Promise

Array of informations wrapped in a Promise

public static create(name: String, composeFile: String): Promise source

Create Docker's container from Docker Compose file.

Params:

NameTypeAttributeDescription
name String

Name of the stack

composeFile String

Docker Compose file content

Return:

Promise

Array of created containers wrapped in a Promise

public static delete(containerId: String): Promise source

Delete Docker's container.

Params:

NameTypeAttributeDescription
containerId String

Container's id

Return:

Promise

Resolved promise

public static events(onMessage: Function): Websocket source

Open WebSocket with auth token for reading events of a Docker's daemon.

Params:

NameTypeAttributeDescription
onMessage Function

Callback for each input event from socket

Return:

Websocket

Opened and authentified Websocket

public static infos(containerId: String): Promise source

Retrieve informations about a Docker's container.

Params:

NameTypeAttributeDescription
containerId String

Container's id

Return:

Promise

Information wrapped in a Promise

public static isLogged(): Boolean source

Check if User is already logged.

Return:

Boolean

True if User has authentification token, false otherwise.

public static login(username: String, password: String): Promise source

Login User given username and password. If success, store auth token in LocalStorage.

Params:

NameTypeAttributeDescription
username String

User's username

password String

User's password

Return:

Promise

Token wrapped in a Promise

public static logout(): Promise source

Logout User by removing User's token.

Return:

Promise

Resolved promise

public static logs(containerId: String, onMessage: Function): Websocket source

Open WebSocket with auth token for reading logs of a Docker's container.

Params:

NameTypeAttributeDescription
containerId String

Container's id

onMessage Function

Callback for each input receive from socket

Return:

Websocket

Opened and authentified Websocket

public static restart(containerId: String): Promise source

Restart Docker's container.

Params:

NameTypeAttributeDescription
containerId String

Container's id

Return:

Promise

Resolved promise

public static start(containerId: String): Promise source

Start Docker's container.

Params:

NameTypeAttributeDescription
containerId String

Container's id

Return:

Promise

Resolved promise

public static stop(containerId: String): Promise source

Stop Docker's container.

Params:

NameTypeAttributeDescription
containerId String

Container's id

Return:

Promise

Resolved promise