Copying files from Docker container to host

user2668128

I'm thinking of using Docker to build my dependencies on a Continuous Integration (CI) server, so that I don't have to install all the runtimes and libraries on the agents themselves.

To achieve this I would need to copy the build artifacts that are built inside the container back into the host. Is that possible?

creack

In order to copy a file from a container to the host, you can use the command

docker cp <containerId>:/file/path/within/container /host/path/target

Here's an example:

$ sudo docker cp goofy_roentgen:/out_read.jpg .

Here goofy_roentgen is the container name I got from the following command:

$ sudo docker ps

CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS              PORTS                                            NAMES
1b4ad9311e93        bamos/openface      "/bin/bash"         33 minutes ago      Up 33 minutes       0.0.0.0:8000->8000/tcp, 0.0.0.0:9000->9000/tcp   goofy_roentgen

You can also use (part of) the Container ID. The following command is equivalent to the first

$ sudo docker cp 1b4a:/out_read.jpg .

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Docker: Copying files from Docker container to host

From Dev

Docker Copying file from host to container

From Java

How to copy files from host to Docker container?

From Dev

How to edit Docker container files from the host?

From Dev

expose files from docker container to host

From Java

Copying files to a container with Docker Compose

From Dev

Copy files from host to docker container then commit and push

From Dev

How to Copy Files From Docker Ubuntu Container to Windows Host

From Dev

Connecting from a docker container to the host?

From Dev

Restarting host from docker container

From Dev

Docker container inaccessible from host

From Dev

Host monitoring from a docker container

From Dev

Docker container inaccessible from host

From Dev

Connecting from a docker container to the host?

From Dev

Generated files on host from docker

From Dev

Mounted docker volume to host directory contains only files from the last container

From Dev

How can I copy files from docker container to my host computer?

From Java

How to access host port from docker container

From Java

Access host database from a docker container

From Dev

Docker replicate UID/GID in container from host

From Dev

How to expose port from host to container in Docker?

From Dev

Docker - cannot access container from Mac Host

From Dev

Run executable from host within docker container

From Dev

Copy folder with wildcard from docker container to host

From Dev

Running a Docker container that accept traffic from the host

From Dev

Docker - modifying IPTABLES for host from container

From Dev

Connecting to mongo docker container from host

From Dev

Mapping user/group from host to docker container

From Dev

Adding host file to docker container - from Dockerfile

Related Related

  1. 1

    Docker: Copying files from Docker container to host

  2. 2

    Docker Copying file from host to container

  3. 3

    How to copy files from host to Docker container?

  4. 4

    How to edit Docker container files from the host?

  5. 5

    expose files from docker container to host

  6. 6

    Copying files to a container with Docker Compose

  7. 7

    Copy files from host to docker container then commit and push

  8. 8

    How to Copy Files From Docker Ubuntu Container to Windows Host

  9. 9

    Connecting from a docker container to the host?

  10. 10

    Restarting host from docker container

  11. 11

    Docker container inaccessible from host

  12. 12

    Host monitoring from a docker container

  13. 13

    Docker container inaccessible from host

  14. 14

    Connecting from a docker container to the host?

  15. 15

    Generated files on host from docker

  16. 16

    Mounted docker volume to host directory contains only files from the last container

  17. 17

    How can I copy files from docker container to my host computer?

  18. 18

    How to access host port from docker container

  19. 19

    Access host database from a docker container

  20. 20

    Docker replicate UID/GID in container from host

  21. 21

    How to expose port from host to container in Docker?

  22. 22

    Docker - cannot access container from Mac Host

  23. 23

    Run executable from host within docker container

  24. 24

    Copy folder with wildcard from docker container to host

  25. 25

    Running a Docker container that accept traffic from the host

  26. 26

    Docker - modifying IPTABLES for host from container

  27. 27

    Connecting to mongo docker container from host

  28. 28

    Mapping user/group from host to docker container

  29. 29

    Adding host file to docker container - from Dockerfile

HotTag

Archive