Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

COPY misbehaves in the presence of any non-empty .dockerignore file #1530

Closed
undecaf opened this issue Apr 17, 2019 · 10 comments
Closed

COPY misbehaves in the presence of any non-empty .dockerignore file #1530

undecaf opened this issue Apr 17, 2019 · 10 comments

Comments

@undecaf
Copy link

undecaf commented Apr 17, 2019

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.

Steps to reproduce the issue:

  1. Create this Dockerfile:
FROM alpine:edge
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 this .dockerignore file (actually, any content except # will do):
X

echo X > .dockerignore
  1. Run podman build .

Describe the results you received:
Directory zzz appears at the image root:

STEP 4: 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):

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

Output of rpm -q buildah or apt list buildah:

buildah/bionic,now 1.8-1~dev~ubuntu18.04~ppa24 amd64  [installiert]

Output of buildah version:

Version:         1.8-dev
Go Version:      go1.10.4
Image Spec:      1.0.0
Runtime Spec:    1.0.0
CNI Spec:        0.4.0
libcni Version:  
Git Commit:      
Built:           Wed Apr 17 01:15:37 2019
OS/Arch:         linux/amd64

Output of podman version if reporting a podman build issue:

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

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

Output of cat /etc/*release:

DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=18.04
DISTRIB_CODENAME=bionic
DISTRIB_DESCRIPTION="Ubuntu 18.04.2 LTS"
NAME="Ubuntu"
VERSION="18.04.2 LTS (Bionic Beaver)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 18.04.2 LTS"
VERSION_ID="18.04"
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
VERSION_CODENAME=bionic
UBUNTU_CODENAME=bionic

Output of uname -a:

Linux hestia 4.15.0-47-generic #50-Ubuntu SMP Wed Mar 13 10:44:52 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux

Output of cat /etc/containers/storage.conf:

# storage.conf is the configuration file for all tools
# that share the containers/storage libraries
# See man 5 containers-storage.conf for more information

# The "container storage" table contains all of the server options.
[storage]

# Default Storage Driver
driver = "overlay"

# Temporary storage location
runroot = "/var/run/containers/storage"

# Primary read-write location of container storage
graphroot = "/var/lib/containers/storage"

[storage.options]
# AdditionalImageStores is used to pass paths to additional read-only image stores
# Must be comma separated list.
additionalimagestores = [
]

# Size is used to set a maximum size of the container image.  Only supported by
# certain container storage drivers (currently overlay, zfs, vfs, btrfs)
size = ""

# OverrideKernelCheck tells the driver to ignore kernel checks based on kernel version
override_kernel_check = "true"
@TomSweeneyRedHat
Copy link
Member

@QiWang19 PTAL

@QiWang19
Copy link
Collaborator

Bot doesn't close this for me. I'll close it.

@undecaf
Copy link
Author

undecaf commented Apr 25, 2019

@QiWang19 I did not close this myself since I intended to wait until the bugfix arrives in buildah/bionic. The most recent version at projectatomic/ppa (1.8-1~dev~ubuntu18.04~ppa25) is not fixed.

@QiWang19
Copy link
Collaborator

👌 , I'll reopen.

@QiWang19 QiWang19 reopened this Apr 25, 2019
@undecaf
Copy link
Author

undecaf commented Apr 25, 2019

@QiWang19 Thank you!

@undecaf
Copy link
Author

undecaf commented May 10, 2019

Unfortunately not yet solved in the current Ubuntu Bionic version: buildah/bionic 1.9.0-1~dev~ubuntu18.04~ppa4 amd64

@undecaf
Copy link
Author

undecaf commented May 13, 2019

@QiWang19 Could you please reopen this? buildah still behaves as described above. Thanks!

@QiWang19
Copy link
Collaborator

@undecaf thanks. It's open already

@undecaf
Copy link
Author

undecaf commented May 13, 2019

I am sorry for the mess, I was mistaken, this is no longer a Buildah bug: buildah bud . yields the correct result:

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

whereas podman build . still gives the wrong result (Podman 1.3.0-1~dev~ubuntu18.04~ppa20):

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

I did not test Buildah in the first place because I thought that podman build uses the installed Buildah instance, but apparently it does not.
Closing this one and opening at containers/libpod

@rhatdan
Copy link
Member

rhatdan commented May 14, 2019

Yes podman build is a vendored version of buildah, meaning it pulls in an older version of buildah code base and compiles it into podman. You can use podman info | grep -i buildah to get the version of buildah used.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 16, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants