Podman: COPY misbehaves in the presence of a non-empty .dockerignore file

Created on 13 May 2019  ·  3Comments  ·  Source: containers/podman

Is this a BUG REPORT or FEATURE REQUEST? (leave only one on its own line)

/kind bug

Description

When COPYing a directory, I expected only the children of the source directory to be copied. However, if a non-empty .dockerignore file exists then the source directory itself is copied.

Resolved in Buildah, see #1530

Steps to reproduce the issue:

  1. Create this Dockerfile:
FROM alpine
COPY zzz /
RUN find / -maxdepth 2 -name 'zzz*'
  1. Create this source directory structure in the context:
zzz/
└── etc/
    └── zzz.conf

mkdir -p zzz/etc
touch zzz/etc/zzz.conf
  1. Create a non-empty .dockerignore file (any content except # will do):
echo X > .dockerignore

Describe the results you received:

Directory zzz appears at the image root:

STEP 3: RUN find / -maxdepth 2 -name 'zzz*'
/zzz

Describe the results you expected:

The content of zzz was merged into the image (this will happen when building with .dockerignore removed or empty or when running buildah bud .):

STEP 3: RUN find / -maxdepth 2 -name 'zzz*'
/etc/zzz.conf

Additional information you deem important (e.g. issue happens only occasionally):

Output of podman version:

RemoteAPI Version:  1
Go Version:         go1.10.4
OS/Arch:            linux/amd64

apt-cache policy podman => 1.3.0-1~dev~ubuntu18.04~ppa20

Output of podman info --debug:

debug:
  compiler: gc
  git commit: ""
  go version: go1.10.4
  podman version: 1.3.0-dev
host:
  BuildahVersion: 1.8-dev
  Conmon:
    package: 'conmon: /usr/libexec/crio/conmon'
    path: /usr/libexec/crio/conmon
    version: 'conmon version , commit: '
  Distribution:
    distribution: ubuntu
    version: "18.04"
  MemFree: 39509430272
  MemTotal: 50631696384
  OCIRuntime:
    package: 'cri-o-runc: /usr/bin/runc'
    path: /usr/bin/runc
    version: 'runc version spec: 1.0.1-dev'
  SwapFree: 0
  SwapTotal: 0
  arch: amd64
  cpus: 16
  hostname: poseidon
  kernel: 4.18.0-18-generic
  os: linux
  rootless: true
  uptime: 3h 42m 14.1s (Approximately 0.12 days)
insecure registries:
  registries: []
registries:
  registries:
  - docker.io
  - registry.fedoraproject.org
  - registry.access.redhat.com
  - registry.centos.org
store:
  ConfigFile: /home/kasper/.config/containers/storage.conf
  ContainerStore:
    number: 0
  GraphDriverName: vfs
  GraphOptions: null
  GraphRoot: /home/kasper/.local/share/containers/storage
  GraphStatus: {}
  ImageStore:
    number: 3
  RunRoot: /tmp/1000
  VolumePath: /home/kasper/.local/share/containers/storage/volumes

Additional environment details (AWS, VirtualBox, physical, etc.):

kinbug

Most helpful comment

If this is fixed in Buildah, we'll pick it up for the next major Podman release when we revendor Buildah.

All 3 comments

If this is fixed in Buildah, we'll pick it up for the next major Podman release when we revendor Buildah.

@undecaf this code should have made it into Buildah v1.8.1 and Buildahv1.8.2 has been vendored into Podman upstream along with v1.3 and the soon to be released v1.3.1. If you could bump your Podman version it should have the fix for you.

@TomSweeneyRedHat Thanks for this info. I will use Buildah as a convenient workaround until Podman v1.3.1 is available for my platform (Ubuntu Bionic).

Was this page helpful?
0 / 5 - 0 ratings