Docker Community Forums

Share and learn in the Docker community.

How can I export a folder from a docker image? Tarballs won't open "Unable to export..(Error 1 - Operation not permitted)"

(Stevenboscarine) #1

I am very new to docker and have a running image. How can I export one folder to my local filesystem?

I want to grab the tomcat from the docker image and run it locally to modify it. I tried the export command, but the tarballs won’t open in OSX. When I double click, it processes for awhile, but returns with an error:

Unable to export “export.tar” into “docker” (Error 1 - Operation not permitted)

Am I doing something wrong? Are there other options for getting a copy of that folder? Here’s the command and docker info output.

bos-mpffg:docker sboscari$ docker export cranky_brattain > ~/export.tar
bos-mpffg:docker sboscari$ docker export --output=~/export2.tar cranky_brattain
bos-mpffg:docker sboscari$ docker info
Containers: 4
Images: 39
Storage Driver: aufs
 Root Dir: /mnt/sda1/var/lib/docker/aufs
 Backing Filesystem: extfs
 Dirs: 47
 Dirperm1 Supported: true
Execution Driver: native-0.2
Logging Driver: json-file
Kernel Version: 4.0.9-boot2docker
Operating System: Boot2Docker 1.8.2 (TCL 6.4); master : aba6192 - Thu Sep 10 20:58:17 UTC 2015
CPUs: 1
Total Memory: 996.2 MiB
Name: default
Debug mode (server): true
File Descriptors: 20
Goroutines: 43
System Time: 2015-10-13T17:31:00.560946926Z
EventsListeners: 1
Init SHA1: 
Init Path: /usr/local/bin/docker
Docker Root Dir: /mnt/sda1/var/lib/docker

(Ranjandas) #2


Docker export is to export the entire container into a tar archive file. If you are looking for copying out a file or directory from the container to your host machine you can use the docker cp command.


docker cp <container id>:/source/file/path/in/container /destination/on/host

# copying /etc directory to host location /tmp
docker cp <contianer id>:/etc/ /tmp