How copy files from current docker container to another container
I am building a docker container with a nodejs application, which will be build from meteorJS. For the build a shell runner is used (`meteor build /opt/project/build/core –directory) as this is all done in a gitlab CI.
build: stage: build tags: - deploy before_script: - docker login -u gitlab-ci-token -p $CI_JOB_TOKEN $CI_REGISTRY - meteor npm install - meteor build /opt/project/build/core --directory script: - cd /opt/project/build/core/bundle - docker build -t $CI_REGISTRY_IMAGE:latest .
So the files of the application are now at
/opt/project/build/core. Now I want to copy those file into another docker image (project-e2e:latest)
I tried to do
docker cp /opt/project/build/core/bundle project-e2e:latest/opt/project/build/core
But this gives me the error
Error response from daemon: No such container: project-e2e
But I see, the container is running:
$ docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES a238132e37a2 project-e2e:latest "/bin/bash" 14 hours ago Up 14 hours clever_kirch
Maybe the problem is, that I’m trying to copy out of the shell runner docker image and the target project-e2e is ‘outside’?
One Solution collect form web for “How copy files from current docker container to another container”
If you want to get the files generated into the container you can copy them by using docker:
docker cp nightwatch:/opt/project/build/core/your_file <your_local_path>
Basically the pattern is:
docker cp <source> <target>
If the source/target is a container, you have to use: