Temp Git context folder does not get completely cleaned up after build #30973
Labels
area/builder
kind/bug
Bugs are bugs. The cause may or may not be known at triage time so debugging may be needed.
Description
Temp folder is not completely cleaned up when invoking a Docker build using a git URL with a folder fragment.
Issue is reproducible using the CLI as well as server-side builds via the API.
Issue does not occur when not specifying a folder fragment.
Steps to reproduce the issue:
(alternatively invoke build via API)
Describe the results you received:
/tmp now contains a 'docker-build-gitXXXXXX' folder which still contains all other folders in the git repository except the folder containing the Dockerfile.
For server-side builds via API, /var/lib/docker/tmp shows the same thing.
Describe the results you expected:
Temporary folders created for the git context should be deleted completely after the build.
Additional information you deem important (e.g. issue happens only occasionally):
Issue appears to be related to
pkg/gitutils/gitutils.go:checkoutGit
in the section which deals with folder fragments.root
gets reassigned tonewCtx
which now has the git folder path appended to it.This probably why only the folder containing the Dockerfile gets deleted in
builder/git.go:MakeGitContext (os.removeAll)
while leaving the rest of the folders intact.Output of
docker version
:Client:
Version: 1.10.3
API version: 1.22
Package version: docker-common-1.10.3-59.el7.x86_64
Go version: go1.6.2
Git commit: 429be27-unsupported
Built: Fri Nov 18 17:03:44 2016
OS/Arch: linux/amd64
Server:
Version: 1.10.3
API version: 1.22
Package version: docker-common-1.10.3-59.el7.x86_64
Go version: go1.6.2
Git commit: 429be27-unsupported
Built: Fri Nov 18 17:03:44 2016
OS/Arch: linux/amd64
Output of
docker info
:Containers: 2
Running: 2
Paused: 0
Stopped: 0
Images: 4
Server Version: 1.10.3
Storage Driver: devicemapper
Pool Name: docker-253:0-201443561-pool
Pool Blocksize: 65.54 kB
Base Device Size: 10.74 GB
Backing Filesystem: xfs
Data file: /dev/loop0
Metadata file: /dev/loop1
Data Space Used: 12.95 GB
Data Space Total: 107.4 GB
Data Space Available: 33.07 GB
Metadata Space Used: 9.118 MB
Metadata Space Total: 2.147 GB
Metadata Space Available: 2.138 GB
Udev Sync Supported: true
Deferred Removal Enabled: false
Deferred Deletion Enabled: false
Deferred Deleted Device Count: 0
Data loop file: /var/lib/docker/devicemapper/devicemapper/data
WARNING: Usage of loopback devices is strongly discouraged for production use. Either use
--storage-opt dm.thinpooldev
or use--storage-opt dm.no_warn_on_loop_devices=true
to suppress this warning.Metadata loop file: /var/lib/docker/devicemapper/devicemapper/metadata
Library Version: 1.02.135-RHEL7 (2016-11-16)
Execution Driver: native-0.2
Logging Driver: json-file
Plugins:
Volume: local
Network: bridge null host
Authorization: rhel-push-plugin
Kernel Version: 3.10.0-514.6.1.el7.x86_64
Operating System: Linux
OSType: linux
Architecture: x86_64
Number of Docker Hooks: 2
CPUs: 2
Total Memory: 3.686 GiB
Name: xxxxxxxx
ID: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Registries: docker.io (secure)
Additional environment details (AWS, VirtualBox, physical, etc.):
Centos 7 (selinux enabled)
The text was updated successfully, but these errors were encountered: