apocas / dockerode

Docker + Node = Dockerode (Node.js module for Docker's Remote API)
Apache License 2.0
4.29k stars 461 forks source link

Clone a container #763

Open ralexrdz opened 3 months ago

ralexrdz commented 3 months ago

I would like to be able to clone a container completely (copy its exact config). So I can create a new one with the same config.

My main goal is to update the image tag of a running container.

Is there any way of doing this? it seems to me that labels and network config could be the main issue since ContainterInfo and CreateContainerOptions seem to be kind of incompatible.

Thanks in advance, dear mantainers

juner commented 1 month ago

see also: Inspect Container https://docs.docker.com/engine/api/v1.40/#tag/Container/operation/ContainerInspect Create Container https://docs.docker.com/engine/api/v1.40/#tag/Container/operation/ContainerCreate

interface ContainerInspectInfo https://github.com/DefinitelyTyped/DefinitelyTyped/blob/b59dc3ac1e2770fbd6cdbb90ba52abe04c168196/types/dockerode/index.d.ts#L516-L647

interface ContainerCreateOptions https://github.com/DefinitelyTyped/DefinitelyTyped/blob/b59dc3ac1e2770fbd6cdbb90ba52abe04c168196/types/dockerode/index.d.ts#L1176-L1211