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)

  • Installing PostgreSQL within a docker container
  • Docker does not free disk usage on Windows 10
  • What is exactly happening when you're Docker Commiting a container?
  • Error running erlang in Windows Container
  • Keeping environment variables on window split
  • How do I link containers in a docker compose file (docker-compose.yml)?
  • 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 - Ok to delete data loop file?
  • Ping until docker is up or until timeout
  • Dockerized MongoDB on Heroku?
  • Cant find output of docker import
  • How to link my custom domain to a bluemix container
  • AWS EB, Play Framework and Docker: Application Already running
  • 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:

    <container_name>:<path_inside_container>

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