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.

  stage: build
    - deploy
    - docker login -u gitlab-ci-token -p $CI_JOB_TOKEN $CI_REGISTRY
    - meteor npm install
    - meteor build /opt/project/build/core --directory
    - 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)

  • Installing Older Docker Engine specifically - 1.11.0~dev
  • Share and update docker data containers across containers
  • swarm, kubernetes or mesos for batch processing jobs
  • Pulling Docker containers from Docker hub behind a proxy results in “certificate signed by unknown authority”
  • Docker-Compose mount on Windows Server 2016 TP4
  • AWS EB deployment - where is my app?
  • 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’?

  • How to forward source IPs to Docker containers without letting Docker mess with iptables
  • How do I turn sendfile off in a docker instance
  • “Cannot connect to the Docker daemon.” error while building docker image in gitlab-ci docker executor
  • How to run bower install inside a Dockerfile?
  • Building a docker play application with gradle
  • Auto-provision new hosts with docker swarm
  • 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:


    Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.