Created
June 24, 2017 01:38
-
-
Save maietta/f445c428665a1ba33bfbc40faa544dc6 to your computer and use it in GitHub Desktop.
If you need to do this on a running container you can use docker exec (added in 1.3).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
First, find the container's name or ID: | |
$ docker ps | |
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES | |
b9b7400ddd8f ubuntu:latest "/bin/bash" 2 seconds ago Up 2 seconds elated_hodgkin | |
In the example above we can either use b9b7400ddd8f or elated_hodgkin. | |
If you wanted to copy everything in /tmp/somefiles on the host to /var/www in the container: | |
$ cd /tmp/somefiles | |
$ tar -cv * | docker exec -i elated_hodgkin tar x -C /var/www | |
We can then exec /bin/bash in the container and verify it worked: | |
$ docker exec -it elated_hodgkin /bin/bash | |
root@b9b7400ddd8f:/# ls /var/www | |
file1 file2 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment