Compare commits

..

10 Commits

Author SHA1 Message Date
0b3e3b68c9 1.0.80 2019-09-22 17:42:29 +02:00
f3779faaaf fix(core): update 2019-09-22 17:42:28 +02:00
73476c2c39 1.0.79 2019-09-22 17:03:53 +02:00
942f65268d fix(core): update 2019-09-22 17:03:53 +02:00
a965647c1f 1.0.78 2019-09-22 15:11:57 +02:00
db88c7f86c fix(core): update 2019-09-22 15:11:57 +02:00
3f18cb68bf 1.0.77 2019-09-22 15:02:29 +02:00
dae3b59e3b fix(core): update 2019-09-22 15:02:29 +02:00
53062e70d4 1.0.76 2019-09-22 14:32:48 +02:00
3e70dc465b fix(core): update 2019-09-22 14:32:48 +02:00
4 changed files with 24 additions and 18 deletions

2
package-lock.json generated
View File

@ -1,6 +1,6 @@
{
"name": "@mojoio/docker",
"version": "1.0.75",
"version": "1.0.80",
"lockfileVersion": 1,
"requires": true,
"dependencies": {

View File

@ -1,6 +1,6 @@
{
"name": "@mojoio/docker",
"version": "1.0.75",
"version": "1.0.80",
"description": "easy communication with docker remote api from node, TypeScript ready",
"private": false,
"main": "dist/index.js",

View File

@ -2,6 +2,7 @@ import * as plugins from './docker.plugins';
import * as interfaces from './interfaces';
import { DockerHost } from './docker.classes.host';
import { DockerService } from './docker.classes.service';
export class DockerNetwork {
public static async getNetworks(dockerHost: DockerHost): Promise<DockerNetwork[]> {
@ -29,16 +30,6 @@ export class DockerNetwork {
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
@ -91,16 +82,28 @@ export class DockerNetwork {
const response = await this.dockerHost.request('DELETE', `/networks/${this.Id}`);
}
public async getContainersOnNetwork(): Promise<{
[key: string]: {
public async getContainersOnNetwork(): Promise<Array<{
Name: string;
EndpointID: string;
MacAddress: string;
IPv4Address: string;
IPv6Address: string;
};
}> {
}>> {
const returnArray = [];
const response = await this.dockerHost.request('GET', `/networks/${this.Id}`);
return response.body.Containers;
for (const key of Object.keys(response.body.Containers)) {
returnArray.push(response.body.Containers[key]);
}
return returnArray;
}
public async getContainersOnNetworkForService(serviceArg: DockerService) {
const containersOnNetwork = await this.getContainersOnNetwork();
const containersOfService = containersOnNetwork.filter(container => {
return container.Name.startsWith(serviceArg.Spec.Name);
});
return containersOfService;
}
}

View File

@ -128,7 +128,10 @@ export class DockerService {
Image: serviceCreationDescriptor.image.RepoTags[0],
Labels: labels,
Secrets: secretArray,
Mounts: mounts
Mounts: mounts,
DNSConfig: {
Nameservers: ['1.1.1.1']
}
},
UpdateConfig: {
Parallelism: 0,