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)

  • Kuberntes master not starting up in OpenStack heat
  • ingensi/play-framework image repetitive downloads
  • Docker best practice scaling
  • Launching more than one container per instance on Elastic Beanstalk
  • Cannot access tomcat8 server running in docker container from host machine
  • docker container using the same volume even after running new container image
  • 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’?

  • docker remote api cannot bind a port to a host
  • Mount samba volume in docker container
  • How can I link docker containers in mesos cluster (dc/os) running on Azure?
  • hostname in docker-compose.yml fails to be recognized on on mac (but works on linux)
  • Trying to create an automated docker build
  • How to startup up services on a Docker image?
  • 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.