Docker Community Forums

Share and learn in the Docker community.

Docker API -> PUT archive and user privileges

(Vincenzo Melandri) #1

Hi all :smile:

I have an issue with the new feature archive from API 1.20.

I have a container running a FOO service under the FOO user, with a work dir of /opt/FOO, that belongs to said FOO user.
So I upload the BAR.tar archive to be put under /opt/FOO/BAR with the following call:

HTTP 1.1 PUT http://${mydockerhost}:4243/containers/${FOO_container_id}/archive?path=/opt/FOO/
{BAR.tar stream}

I get 200 OK from it, the archive is extracted in the correct location, but it belongs to root. That makes it unusable for my FOO service. :frowning:
Here is the content of the /opt/FOO folder:

[root@mydockerhost ~]# docker exec -i ${FOO_container_id} sh -c 'ls -al /opt/FOO/'
total 1172
drwxr-xr-x. 10 FOO FOO   4096 Sep 29 00:26 .
drwxr-xr-x.  3 FOO FOO   4096 Sep 24 17:37 ..
-rw-r--r--.  1 FOO FOO 503614 Sep 16 19:07 someFOOstuff
-rw-r--r--.  1 FOO FOO  12646 Aug 12 09:16 somemoreFOOstuff
-rw-r--r--.  1 FOO FOO 566457 Sep  9 11:31 otherFOOstuff
drwx------.  3 root root   4096 Sep 24 21:40 BAR
drwxr-xr-x. 11 FOO FOO   4096 Sep 24 17:37 someFOOfolder

Is it a bug, is it the intended functionality that the archives are always extracted as root, is there a way to workaround this, to specify the user the archive should belongs too? (I know I can pipe a tar into the container and then extract it there, but I would like to use the API for this)


(Vincenzo Melandri) #2

Can anyone point me to the appropriate documentation or should I file this as a bug?