MCPcopy
hub / github.com/serverless/serverless / getContainerIfExists

Method getContainerIfExists

packages/util/src/docker/index.js:39–50  ·  view source on GitHub ↗

* Gets a container if it exists, returns null if it doesn't * @param {Object} params * @param {string} params.containerName - Name of container to get * @returns {Promise } Container object or null if not found

({ containerName })

Source from the content-addressed store, hash-verified

37 * @returns {Promise<Container|null>} Container object or null if not found
38 */
39 async getContainerIfExists({ containerName }) {
40 try {
41 const container = this.client.getContainer(containerName)
42 await container.inspect()
43 return container
44 } catch (error) {
45 if (error.statusCode === 404) {
46 return null
47 }
48 throw error
49 }
50 }
51
52 /**
53 * Gets a Docker container by name

Callers 2

tailLogsMethod · 0.95
#initializeProxyMethod · 0.80

Calls 1

getContainerMethod · 0.80

Tested by

no test coverage detected