Posts

Copying data between containers and host

Image
When working with docker containers you will come across scenarios where you will need to copy data from container to host or viceversa. This can be achieved either by using docker volume or by using docker cp command. In this post we will cover 3 scenarios: Copying files or folders from container to host: docker cp "container name:mountpoint of container" "destination path on host" Copying files or folders from host to container: First we will create directory inside the container and then copy the files inside it docker exec -ti apache container bash -c 'mkdir /ashish' Now copy files in this newly created directory