RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 1307049 - Docker's ADD can't handle a local tar archive with file capabilities in xattr
Summary: Docker's ADD can't handle a local tar archive with file capabilities in xattr
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: docker
Version: 7.2
Hardware: x86_64
OS: Linux
unspecified
medium
Target Milestone: rc
: ---
Assignee: Antonio Murdaca
QA Contact: atomic-bugs@redhat.com
URL:
Whiteboard:
: 1307047 1307051 (view as bug list)
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2016-02-12 14:57 UTC by Jim Perrin
Modified: 2019-03-06 02:45 UTC (History)
5 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2016-08-21 10:19:33 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)

Description Jim Perrin 2016-02-12 14:57:52 UTC
Description of problem:
Building a base container from scratch with a tar archive fails if the archive contains file capabilities.

Version-Release number of selected component (if applicable):
docker-1.8.2-10

How reproducible:
Always

Steps to Reproduce:
1. Create a base disk image with livemedia-creator

example commands used are available on github: 
https://github.com/CentOS/sig-cloud-instance-build/tree/livemedia_builds/docker

2. Create a container from the resulting tarball via a very basic Dockerfile. Something like the following:

=====
FROM scratch
MAINTAINER me
ADD centos-img.tar.xz /
=====

docker run --rm -t centostest .

3. run the container and observe that the capabilities are stripped from the iputils package. 

[root@73ba9b203c2b /]# rpm -V iputils
........P    /usr/bin/ping
........P    /usr/bin/ping6
........P    /usr/sbin/arping
........P    /usr/sbin/clockdiff


4. Create the archive with tar directly:

kpartx -a /var/tmp/centos-7-root
mount /dev/mapper/loop0p1 /mnt

tar -C /mnt/ -jcf centos-img.tar.bz2 .

Build docker container using this tarball, just as above. 

Same output from running rpm -V iputils in this container.

[root@92bca8435dd8 /]# rpm -V iputils
........P    /usr/bin/ping
........P    /usr/bin/ping6
........P    /usr/sbin/arping
........P    /usr/sbin/clockdiff


5. Create archive with --xattr, to maintain file capabilities

tar --xattrs -C /mnt/ -jcf centos-img.tar.bz2 .

Build docker container using this tarball:


Note that the resulting container is only slightly larger than the tarball itself. 

6. Examine the contents of the docker container:

docker create --name wtf c7build

[root@lappy ~]# docker export wtf | tar -t
.dockerenv
.dockerinit
centos-img.tar.bz2
dev/
dev/console
dev/pts/
dev/shm/
etc/
etc/hostname
etc/hosts
etc/mtab
etc/resolv.conf
lib64
proc/
sys/


Docker's for some reason not extracted this archive, but instead stuffed it inside the container which won't work. 

Validate that the capabilities are intact by importing the tar archive directly

cat centos-img.tar.bz2 | docker import - capvalidate

docker run --rm -it capvalidate /bin/bash
[root@cf2021d70a42 /]# rpm -V iputils
[root@cf2021d70a42 /]#



Actual results:
containers including files with capabilities (like ping) don't get unpacked via an ADD in a dockerfile

Expected results:
ADD unpacks the tarball and a base container is happily created.

Comment 2 Daniel Walsh 2016-02-12 16:05:02 UTC
This looks like golang's tar which is what docker uses I believe does not support xattrs.

Comment 3 Daniel Walsh 2016-02-12 16:12:05 UTC
*** Bug 1307051 has been marked as a duplicate of this bug. ***

Comment 4 Daniel Walsh 2016-02-12 16:13:11 UTC
*** Bug 1307047 has been marked as a duplicate of this bug. ***

Comment 5 Vincent Batts 2016-02-12 19:39:36 UTC
surely it does. Alexl added that support.
https://golang.org/pkg/archive/tar/#Header

Comment 6 Daniel Walsh 2016-02-22 19:25:12 UTC
Antonio have you been working on this?

Comment 7 Antonio Murdaca 2016-08-20 18:46:09 UTC
Fixed in docker-1.10


Note You need to log in before you can comment on or make changes to this bug.