Copy is deprecated, what to use instead? #699
Answered
by
electrovir
electrovir
asked this question in
Q&A
-
I'm trying to port a bash command that uses What's the alternative to using |
Beta Was this translation helpful? Give feedback.
Answered by
electrovir
Oct 24, 2022
Replies: 1 comment
-
It looks like the solution is to use the import * as tar from 'tar';
import Docker from 'dockerode';
import {readdir} from 'fs/promises';
const docker = new Docker();
const container = docker.getContainer('container-name-here');
await tar.c(
{gzip: true, file: 'tar-file-name-here.tar', cwd: 'dir-of-files-to-copy'},
await readdir('dir-of-files-to-copy'),
);
await container.putArchive('tar-file-name-here.tar', {path: 'container-path-to-copy-to-here'}); |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
electrovir
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
It looks like the solution is to use the
tar
package from npm in conjunction with this package'sContainer.putArchive
method. Like this: