fix(core): update
This commit is contained in:
parent
a202d05e9c
commit
373a4e2eac
29
.vscode/launch.json
vendored
Normal file
29
.vscode/launch.json
vendored
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
{
|
||||||
|
"version": "0.2.0",
|
||||||
|
"configurations": [
|
||||||
|
{
|
||||||
|
"name": "current file",
|
||||||
|
"type": "node",
|
||||||
|
"request": "launch",
|
||||||
|
"args": [
|
||||||
|
"${relativeFile}"
|
||||||
|
],
|
||||||
|
"runtimeArgs": ["-r", "@gitzone/tsrun"],
|
||||||
|
"cwd": "${workspaceRoot}",
|
||||||
|
"protocol": "inspector",
|
||||||
|
"internalConsoleOptions": "openOnSessionStart"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "test.ts",
|
||||||
|
"type": "node",
|
||||||
|
"request": "launch",
|
||||||
|
"args": [
|
||||||
|
"test/test.ts"
|
||||||
|
],
|
||||||
|
"runtimeArgs": ["-r", "@gitzone/tsrun"],
|
||||||
|
"cwd": "${workspaceRoot}",
|
||||||
|
"protocol": "inspector",
|
||||||
|
"internalConsoleOptions": "openOnSessionStart"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
13
README.md
13
README.md
@ -1,16 +1,13 @@
|
|||||||
# @mojoio/docker
|
# @mojoio/docker
|
||||||
|
|
||||||
unofficial docker engine api abstraction package written in TypeScript
|
unofficial docker engine api abstraction package written in TypeScript
|
||||||
|
|
||||||
## Availabililty and Links
|
## Availabililty and Links
|
||||||
|
* [npmjs.org (npm package)](https://www.npmjs.com/package/@mojoio/docker)
|
||||||
- [npmjs.org (npm package)](https://www.npmjs.com/package/@mojoio/docker)
|
* [gitlab.com (source)](https://gitlab.com/mojoio/docker)
|
||||||
- [gitlab.com (source)](https://gitlab.com/mojoio/docker)
|
* [github.com (source mirror)](https://github.com/mojoio/docker)
|
||||||
- [github.com (source mirror)](https://github.com/mojoio/docker)
|
* [docs (typedoc)](https://mojoio.gitlab.io/docker/)
|
||||||
- [docs (typedoc)](https://mojoio.gitlab.io/docker/)
|
|
||||||
|
|
||||||
## Status for master
|
## Status for master
|
||||||
|
|
||||||
[![build status](https://gitlab.com/mojoio/docker/badges/master/build.svg)](https://gitlab.com/mojoio/docker/commits/master)
|
[![build status](https://gitlab.com/mojoio/docker/badges/master/build.svg)](https://gitlab.com/mojoio/docker/commits/master)
|
||||||
[![coverage report](https://gitlab.com/mojoio/docker/badges/master/coverage.svg)](https://gitlab.com/mojoio/docker/commits/master)
|
[![coverage report](https://gitlab.com/mojoio/docker/badges/master/coverage.svg)](https://gitlab.com/mojoio/docker/commits/master)
|
||||||
[![npm downloads per month](https://img.shields.io/npm/dm/@mojoio/docker.svg)](https://www.npmjs.com/package/@mojoio/docker)
|
[![npm downloads per month](https://img.shields.io/npm/dm/@mojoio/docker.svg)](https://www.npmjs.com/package/@mojoio/docker)
|
||||||
@ -36,6 +33,6 @@ const run = async () => {
|
|||||||
For further information read the linked docs at the top of this readme.
|
For further information read the linked docs at the top of this readme.
|
||||||
|
|
||||||
> MIT licensed | **©** [Lossless GmbH](https://lossless.gmbh)
|
> MIT licensed | **©** [Lossless GmbH](https://lossless.gmbh)
|
||||||
> | By using this npm module you agree to our [privacy policy](https://lossless.gmbH/privacy)
|
| By using this npm module you agree to our [privacy policy](https://lossless.gmbH/privacy)
|
||||||
|
|
||||||
[![repo-footer](https://lossless.gitlab.io/publicrelations/repofooter.svg)](https://maintainedby.lossless.com)
|
[![repo-footer](https://lossless.gitlab.io/publicrelations/repofooter.svg)](https://maintainedby.lossless.com)
|
||||||
|
40
test/test.ts
40
test/test.ts
@ -1,23 +1,49 @@
|
|||||||
import { expect, tap } from '@pushrocks/tapbundle';
|
import { expect, tap } from '@pushrocks/tapbundle';
|
||||||
import { DockerHost } from '../ts/index';
|
import * as docker from '../ts/index';
|
||||||
|
|
||||||
let testDockerHost: DockerHost;
|
let testDockerHost: docker.DockerHost;
|
||||||
|
|
||||||
tap.test('should create a new Dockersock instance', async () => {
|
tap.test('should create a new Dockersock instance', async () => {
|
||||||
testDockerHost = new DockerHost();
|
testDockerHost = new docker.DockerHost();
|
||||||
return expect(testDockerHost).to.be.instanceof(DockerHost);
|
return expect(testDockerHost).to.be.instanceof(docker.DockerHost);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Containers
|
||||||
tap.test('should list containers', async () => {
|
tap.test('should list containers', async () => {
|
||||||
const containers = await testDockerHost.getContainers();
|
const containers = await testDockerHost.getContainers();
|
||||||
console.log(containers);
|
console.log(containers);
|
||||||
});
|
});
|
||||||
|
|
||||||
tap.skip.test('should pull an image from imagetag', async () => {
|
// Networks
|
||||||
// await testDockerHost.pullImage('hosttoday/ht-docker-node:npmci');
|
tap.test('should list networks', async () => {
|
||||||
|
const networks = await testDockerHost.getNetworks();
|
||||||
|
console.log(networks);
|
||||||
});
|
});
|
||||||
|
|
||||||
tap.test('should return a change Objservable', async tools => {
|
tap.test('should create a network', async () => {
|
||||||
|
const newNetwork = await docker.DockerNetwork.createNetwork(testDockerHost, {
|
||||||
|
Name: 'webgateway'
|
||||||
|
});
|
||||||
|
expect(newNetwork).to.be.instanceOf(docker.DockerNetwork);
|
||||||
|
expect(newNetwork.Name).to.equal('webgateway');
|
||||||
|
});
|
||||||
|
|
||||||
|
tap.test('should remove a network', async () => {
|
||||||
|
const webgateway = await docker.DockerNetwork.getNetworkByName(testDockerHost, 'webgateway');
|
||||||
|
await webgateway.remove();
|
||||||
|
});
|
||||||
|
|
||||||
|
// Images
|
||||||
|
tap.test('should pull an image from imagetag', async () => {
|
||||||
|
const image = await docker.DockerImage.createFromRegistry(testDockerHost, {
|
||||||
|
imageUrl: 'hosttoday/ht-docker-node',
|
||||||
|
tag: 'alpine'
|
||||||
|
});
|
||||||
|
expect(image).to.be.instanceOf(docker.DockerImage);
|
||||||
|
console.log(image);
|
||||||
|
});
|
||||||
|
|
||||||
|
tap.test('should return a change Observable', async tools => {
|
||||||
const testObservable = await testDockerHost.getEventObservable();
|
const testObservable = await testDockerHost.getEventObservable();
|
||||||
const subscription = testObservable.subscribe(changeObject => {
|
const subscription = testObservable.subscribe(changeObject => {
|
||||||
console.log(changeObject);
|
console.log(changeObject);
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import * as plugins from './dockersock.plugins';
|
import * as plugins from './docker.plugins';
|
||||||
import * as interfaces from './interfaces';
|
import * as interfaces from './interfaces';
|
||||||
|
|
||||||
import { DockerHost } from './docker.classes.host';
|
import { DockerHost } from './docker.classes.host';
|
||||||
@ -15,7 +15,7 @@ export class DockerContainer {
|
|||||||
|
|
||||||
// TODO: Think about getting the config by inpsecting the container
|
// TODO: Think about getting the config by inpsecting the container
|
||||||
for (const containerResult of response.body) {
|
for (const containerResult of response.body) {
|
||||||
result.push(new DockerContainer(containerResult));
|
result.push(new DockerContainer(dockerHostArg, containerResult));
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@ -31,17 +31,33 @@ export class DockerContainer {
|
|||||||
/**
|
/**
|
||||||
* create a container
|
* create a container
|
||||||
*/
|
*/
|
||||||
public static async create(dockerHost: DockerHost, containerCreationDescriptor: interfaces.IContainerCreationDescriptor) {
|
public static async create(
|
||||||
// TODO implement creating a container
|
dockerHost: DockerHost,
|
||||||
|
containerCreationDescriptor: interfaces.IContainerCreationDescriptor
|
||||||
|
) {
|
||||||
|
// check for unique hostname
|
||||||
|
const existingContainers = await DockerContainer.getContainers(dockerHost);
|
||||||
|
const sameHostNameContainer = existingContainers.find(container => {
|
||||||
|
// TODO implement HostName Detection;
|
||||||
|
return false;
|
||||||
|
});
|
||||||
|
const response = await dockerHost.request('POST', '/containers/create', {
|
||||||
|
Hostname: containerCreationDescriptor.Hostname,
|
||||||
|
Domainname: containerCreationDescriptor.Domainname,
|
||||||
|
User: 'root'
|
||||||
|
});
|
||||||
|
if (response.statusCode < 300) {
|
||||||
|
plugins.smartlog.defaultLogger.log('info', 'Container created successfully');
|
||||||
|
} else {
|
||||||
|
plugins.smartlog.defaultLogger.log('error', 'There has been a problem when creating the container');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// INSTANCE
|
// INSTANCE
|
||||||
constructor(dockerContainerObjectArg: any) {
|
// references
|
||||||
Object.keys(dockerContainerObjectArg).forEach(keyArg => {
|
public dockerHost: DockerHost;
|
||||||
this[keyArg] = dockerContainerObjectArg[keyArg];
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
|
// properties
|
||||||
public Id: string;
|
public Id: string;
|
||||||
public Names: string[];
|
public Names: string[];
|
||||||
public Image: string;
|
public Image: string;
|
||||||
@ -73,4 +89,10 @@ export class DockerContainer {
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
public Mounts: any;
|
public Mounts: any;
|
||||||
|
constructor(dockerHostArg: DockerHost, dockerContainerObjectArg: any) {
|
||||||
|
this.dockerHost = dockerHostArg;
|
||||||
|
Object.keys(dockerContainerObjectArg).forEach(keyArg => {
|
||||||
|
this[keyArg] = dockerContainerObjectArg[keyArg];
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import * as plugins from './dockersock.plugins';
|
import * as plugins from './docker.plugins';
|
||||||
import { DockerContainer } from './docker.classes.container';
|
import { DockerContainer } from './docker.classes.container';
|
||||||
import { DockerNetwork } from './docker.classes.network';
|
import { DockerNetwork } from './docker.classes.network';
|
||||||
|
|
||||||
@ -30,7 +30,7 @@ export class DockerHost {
|
|||||||
* gets all networks
|
* gets all networks
|
||||||
*/
|
*/
|
||||||
public async getNetworks() {
|
public async getNetworks() {
|
||||||
DockerNetwork.getNetworks(this);
|
return await DockerNetwork.getNetworks(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -41,6 +41,9 @@ export class DockerHost {
|
|||||||
return containerArray;
|
return containerArray;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
public async getEventObservable(): Promise<plugins.rxjs.Observable<any>> {
|
public async getEventObservable(): Promise<plugins.rxjs.Observable<any>> {
|
||||||
const response = await this.requestStreaming('GET', '/events');
|
const response = await this.requestStreaming('GET', '/events');
|
||||||
return plugins.rxjs.Observable.create(observer => {
|
return plugins.rxjs.Observable.create(observer => {
|
||||||
@ -59,6 +62,25 @@ export class DockerHost {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* activates docker swarm
|
||||||
|
*/
|
||||||
|
public async activateSwarm(addvertisementIpArg: string) {
|
||||||
|
const response = await this.request('POST', '/swarm/init', {
|
||||||
|
ListenAddr: '0.0.0.0:2377',
|
||||||
|
AdvertiseAddr: `${addvertisementIpArg}:2377`,
|
||||||
|
DataPathPort: 4789,
|
||||||
|
DefaultAddrPool: ['10.10.0.0/8', '20.20.0.0/8'],
|
||||||
|
SubnetSize: 24,
|
||||||
|
ForceNewCluster: false
|
||||||
|
});
|
||||||
|
if (response.statusCode === 200) {
|
||||||
|
plugins.smartlog.defaultLogger.log('info', 'created Swam succesfully');
|
||||||
|
} else {
|
||||||
|
plugins.smartlog.defaultLogger.log('error', 'could not initiate swarm');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* fire a request
|
* fire a request
|
||||||
*/
|
*/
|
||||||
@ -72,6 +94,9 @@ export class DockerHost {
|
|||||||
},
|
},
|
||||||
requestBody: dataArg
|
requestBody: dataArg
|
||||||
});
|
});
|
||||||
|
if (response.statusCode !== 200) {
|
||||||
|
console.log(response.body);
|
||||||
|
}
|
||||||
return response;
|
return response;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,38 +1,104 @@
|
|||||||
import * as plugins from './dockersock.plugins';
|
import * as plugins from './docker.plugins';
|
||||||
|
import * as interfaces from './interfaces';
|
||||||
import { DockerHost } from './docker.classes.host';
|
import { DockerHost } from './docker.classes.host';
|
||||||
|
|
||||||
export class DockerImage {
|
export class DockerImage {
|
||||||
// STATIC
|
// STATIC
|
||||||
public static async createFromRegistry(
|
public static async getImages(dockerHost: DockerHost) {
|
||||||
dockerHostArg: DockerHost,
|
const images: DockerImage[] = [];
|
||||||
dockerImageTag
|
const response = await dockerHost.request('GET', '/images/json');
|
||||||
): Promise<DockerImage> {
|
for (const imageObject of response.body) {
|
||||||
const resultingImage = new DockerImage();
|
images.push(new DockerImage(dockerHost, imageObject));
|
||||||
|
}
|
||||||
return resultingImage;
|
return images;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static async createFromExistingImage(dockerHostArg: DockerHost, dockerImageTag) {}
|
public static async createFromRegistry(
|
||||||
|
dockerHostArg: DockerHost,
|
||||||
|
creationObject: interfaces.IImageCreationDescriptor
|
||||||
|
): Promise<DockerImage> {
|
||||||
|
const response = await dockerHostArg.request(
|
||||||
|
'POST',
|
||||||
|
`/images/create?fromImage=${encodeURIComponent(
|
||||||
|
creationObject.imageUrl
|
||||||
|
)}&tag=${encodeURIComponent(creationObject.tag)}`
|
||||||
|
);
|
||||||
|
if (response.statusCode < 300) {
|
||||||
|
plugins.smartlog.defaultLogger.log(
|
||||||
|
'info',
|
||||||
|
`Successfully pulled image ${creationObject.imageUrl} from the registry`
|
||||||
|
);
|
||||||
|
const image = (await DockerImage.getImages(dockerHostArg)).find(image => true);
|
||||||
|
return image;
|
||||||
|
} else {
|
||||||
|
plugins.smartlog.defaultLogger.log('error', `Failed at the attempt of creating a new image`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static async tagImageByIdOrName(
|
||||||
|
dockerHost: DockerHost,
|
||||||
|
idOrNameArg: string,
|
||||||
|
newTagArg: string
|
||||||
|
) {
|
||||||
|
const response = await dockerHost.request(
|
||||||
|
'POST',
|
||||||
|
`/images/${encodeURIComponent(idOrNameArg)}/${encodeURIComponent(newTagArg)}`
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static async buildImage(dockerHostArg: DockerHost, dockerImageTag) {
|
||||||
|
// TODO: implement building an image
|
||||||
|
}
|
||||||
|
|
||||||
// INSTANCE
|
// INSTANCE
|
||||||
|
// references
|
||||||
|
public dockerHost: DockerHost;
|
||||||
|
|
||||||
|
// properties
|
||||||
/**
|
/**
|
||||||
* the tags for an image
|
* the tags for an image
|
||||||
*/
|
*/
|
||||||
public tags: string[] = [];
|
public tags: string[];
|
||||||
|
public Containers: number;
|
||||||
|
public Created: number;
|
||||||
|
public Id: string;
|
||||||
|
public Labels: interfaces.TLabels;
|
||||||
|
public ParentId: string;
|
||||||
|
public RepoDigests: string[];
|
||||||
|
public RepoTags: string[];
|
||||||
|
public SharedSize: number;
|
||||||
|
public Size: number;
|
||||||
|
public VirtualSize: number;
|
||||||
|
|
||||||
|
constructor(dockerHostArg, dockerImageObjectArg: any) {
|
||||||
|
this.dockerHost = dockerHostArg;
|
||||||
|
Object.keys(dockerImageObjectArg).forEach(keyArg => {
|
||||||
|
this[keyArg] = dockerImageObjectArg[keyArg];
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* returns a boolean wether the image has a upstream image
|
* returns a boolean wether the image has a upstream image
|
||||||
*/
|
*/
|
||||||
public isUpstreamImage(): boolean {
|
public isUpstreamImage(): boolean {
|
||||||
// TODO: implement isUpastreamImage
|
// TODO: implement isUpastreamImage
|
||||||
return true;
|
return this.RepoTags.length > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
* pulls the latest version from the registry
|
||||||
*/
|
*/
|
||||||
public async pullLatestImageFromRegistry(): Promise<boolean> {
|
public async pullLatestImageFromRegistry(): Promise<boolean> {
|
||||||
// TODO: implement pullLatestImageFromRegistry
|
const dockerImageUrl = this.RepoTags[0].split(':')[0];
|
||||||
|
const dockerImageTag = this.RepoTags[0].split(':')[1];
|
||||||
|
const updatedImage = await DockerImage.createFromRegistry(this.dockerHost, {
|
||||||
|
imageUrl: dockerImageUrl,
|
||||||
|
tag: dockerImageTag
|
||||||
|
});
|
||||||
|
Object.assign(this, updatedImage);
|
||||||
|
// TODO: Compare image digists before and after
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import * as plugins from './dockersock.plugins';
|
import * as plugins from './docker.plugins';
|
||||||
import * as interfaces from './interfaces';
|
import * as interfaces from './interfaces';
|
||||||
|
|
||||||
import { DockerHost } from './docker.classes.host';
|
import { DockerHost } from './docker.classes.host';
|
||||||
@ -6,19 +6,55 @@ import { DockerHost } from './docker.classes.host';
|
|||||||
export class DockerNetwork {
|
export class DockerNetwork {
|
||||||
public static async getNetworks(dockerHost: DockerHost): Promise<DockerNetwork[]> {
|
public static async getNetworks(dockerHost: DockerHost): Promise<DockerNetwork[]> {
|
||||||
const dockerNetworks: DockerNetwork[] = [];
|
const dockerNetworks: DockerNetwork[] = [];
|
||||||
|
const response = await dockerHost.request('GET', '/networks');
|
||||||
|
for (const networkObject of response.body) {
|
||||||
|
dockerNetworks.push(new DockerNetwork(dockerHost, networkObject));
|
||||||
|
}
|
||||||
return dockerNetworks;
|
return dockerNetworks;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static async createNetwork(dockerHost: DockerHost, networkCreationDescriptor) {
|
public static async getNetworkByName(dockerHost: DockerHost, dockerNetworkNameArg: string) {
|
||||||
// TODO: implement create network
|
const networks = await DockerNetwork.getNetworks(dockerHost);
|
||||||
|
return networks.find(dockerNetwork => dockerNetwork.Name === dockerNetworkNameArg);
|
||||||
}
|
}
|
||||||
|
|
||||||
constructor(dockerNetworkObjectArg: any) {
|
public static async createNetwork(
|
||||||
Object.keys(dockerNetworkObjectArg).forEach(keyArg => {
|
dockerHost: DockerHost,
|
||||||
this[keyArg] = dockerNetworkObjectArg[keyArg];
|
networkCreationDescriptor: interfaces.INetworkCreationDescriptor
|
||||||
|
): Promise<DockerNetwork> {
|
||||||
|
const response = await dockerHost.request('POST', '/networks/create', {
|
||||||
|
Name: networkCreationDescriptor.Name,
|
||||||
|
CheckDuplicate: true,
|
||||||
|
Driver: 'overlay',
|
||||||
|
EnableIPv6: false,
|
||||||
|
IPAM: {
|
||||||
|
Driver: 'default',
|
||||||
|
Config: [
|
||||||
|
{
|
||||||
|
Subnet: '172.20.10.0/16',
|
||||||
|
IPRange: '172.20.10.0/24',
|
||||||
|
Gateway: '172.20.10.11'
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
Internal: true,
|
||||||
|
Attachable: true,
|
||||||
|
Ingress: false
|
||||||
});
|
});
|
||||||
|
if (response.statusCode < 300 ) {
|
||||||
|
plugins.smartlog.defaultLogger.log('info', 'Created network successfully');
|
||||||
|
return await DockerNetwork.getNetworkByName(dockerHost, networkCreationDescriptor.Name);
|
||||||
|
} else {
|
||||||
|
plugins.smartlog.defaultLogger.log('error', 'There has been an error creating the wanted network');
|
||||||
|
return null
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// INSTANCE
|
||||||
|
// references
|
||||||
|
public dockerHost: DockerHost;
|
||||||
|
|
||||||
|
// properties
|
||||||
public Name: string;
|
public Name: string;
|
||||||
public Id: string;
|
public Id: string;
|
||||||
public Created: string;
|
public Created: string;
|
||||||
@ -29,15 +65,27 @@ export class DockerNetwork {
|
|||||||
public Attachable: boolean;
|
public Attachable: boolean;
|
||||||
public Ingress: false;
|
public Ingress: false;
|
||||||
public IPAM: {
|
public IPAM: {
|
||||||
Driver: "default" | "bridge" | "overlay",
|
Driver: 'default' | 'bridge' | 'overlay';
|
||||||
Config: [
|
Config: [
|
||||||
{
|
{
|
||||||
Subnet: string,
|
Subnet: string;
|
||||||
IPRange: string,
|
IPRange: string;
|
||||||
Gateway: string
|
Gateway: string;
|
||||||
}
|
}
|
||||||
]
|
];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
constructor(dockerHostArg: DockerHost, dockerNetworkObjectArg: any) {
|
||||||
|
this.dockerHost = dockerHostArg;
|
||||||
|
Object.keys(dockerNetworkObjectArg).forEach(keyArg => {
|
||||||
|
this[keyArg] = dockerNetworkObjectArg[keyArg];
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* removes the network
|
||||||
|
*/
|
||||||
|
public async remove() {
|
||||||
|
const response = await this.dockerHost.request('DELETE', `/networks/${this.Id}`);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import * as plugins from './dockersock.plugins';
|
import * as plugins from './docker.plugins';
|
||||||
import * as interfaces from './interfaces';
|
import * as interfaces from './interfaces';
|
||||||
|
|
||||||
import { DockerHost } from './docker.classes.host';
|
import { DockerHost } from './docker.classes.host';
|
||||||
|
@ -4,6 +4,8 @@ import * as smartlog from '@pushrocks/smartlog';
|
|||||||
import * as smartpromise from '@pushrocks/smartpromise';
|
import * as smartpromise from '@pushrocks/smartpromise';
|
||||||
import * as smartrequest from '@pushrocks/smartrequest';
|
import * as smartrequest from '@pushrocks/smartrequest';
|
||||||
|
|
||||||
|
smartlog.defaultLogger.enableConsole();
|
||||||
|
|
||||||
export { lik, smartlog, smartpromise, smartrequest };
|
export { lik, smartlog, smartpromise, smartrequest };
|
||||||
|
|
||||||
// third party
|
// third party
|
@ -1,7 +1,7 @@
|
|||||||
import { DockerNetwork } from '../docker.classes.network';
|
import { DockerNetwork } from '../docker.classes.network';
|
||||||
|
|
||||||
export interface IContainerCreationDescriptor {
|
export interface IContainerCreationDescriptor {
|
||||||
hostname: string;
|
Hostname: string;
|
||||||
domainName: string;
|
Domainname: string;
|
||||||
networks?: DockerNetwork[];
|
networks?: DockerNetwork[];
|
||||||
}
|
}
|
||||||
|
4
ts/interfaces/image.ts
Normal file
4
ts/interfaces/image.ts
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
export interface IImageCreationDescriptor {
|
||||||
|
imageUrl: string;
|
||||||
|
tag: string;
|
||||||
|
}
|
@ -1,3 +1,5 @@
|
|||||||
export * from './container';
|
export * from './container';
|
||||||
|
export * from './image';
|
||||||
export * from './label';
|
export * from './label';
|
||||||
|
export * from './network';
|
||||||
export * from './port';
|
export * from './port';
|
||||||
|
6
ts/interfaces/network.ts
Normal file
6
ts/interfaces/network.ts
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
/**
|
||||||
|
* creates a new Network
|
||||||
|
*/
|
||||||
|
export interface INetworkCreationDescriptor {
|
||||||
|
Name: string;
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user