Compare commits

..

18 Commits

Author SHA1 Message Date
de2d7e647b 1.0.84 2019-09-24 20:20:37 +02:00
d9348bd016 fix(Image().getVersion()): now returns 0.0.0 for unavailable versions to make SemVer work later on 2019-09-24 20:20:37 +02:00
034fbc3994 1.0.83 2019-09-23 13:52:52 +02:00
a33a6a1f7f fix(core): update 2019-09-23 13:52:52 +02:00
9dd403821b 1.0.82 2019-09-23 13:41:06 +02:00
601d82ea74 fix(core): update 2019-09-23 13:41:06 +02:00
784bb22511 1.0.81 2019-09-22 23:42:30 +02:00
71c89ac9bc fix(core): update 2019-09-22 23:42:29 +02:00
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
5 changed files with 31 additions and 15 deletions

2
package-lock.json generated
View File

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

View File

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

View File

@ -140,7 +140,7 @@ export class DockerImage {
if (this.Labels && this.Labels.version) {
return this.Labels.version;
} else {
return 'x.x.x';
return '0.0.0';
}
}
}

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,17 +30,17 @@ export class DockerNetwork {
CheckDuplicate: true,
Driver: 'overlay',
EnableIPv6: false,
IPAM: {
/* IPAM: {
Driver: 'default',
Config: [
{
Subnet: '172.20.10.0/16',
IPRange: '172.20.10.0/24',
Gateway: '172.20.10.11'
Subnet: `172.20.${networkCreationDescriptor.NetworkNumber}.0/16`,
IPRange: `172.20.${networkCreationDescriptor.NetworkNumber}.0/24`,
Gateway: `172.20.${networkCreationDescriptor.NetworkNumber}.11`
}
]
},
Internal: true,
}, */
Internal: false,
Attachable: true,
Ingress: false
});
@ -91,16 +92,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,