Comments (10)
+1 to addressing this, it feels like a bug in the implementation of the Dockerfile format.
from imagebuilder.
// from source wildcards is only a file
// result: a file
$ ./imagebuilder -f Dockerfile.wildcard .
--> FROM alpine as 0
--> COPY ./README.m* /cp
--> RUN ls -l cp
-rw-rw-r-- 1 root root 3922 Aug 9 16:41 cp
--> Committing changes ...
--> Done
//from source wildcards is a folder
// result: directory
$ ./imagebuilder -f Dockerfile.wildcard .
--> FROM alpine as 0
--> COPY ./READMED* /cp
--> RUN ls -l cp
total 4
-rw-rw-r-- 1 root root 13 Aug 9 17:01 cpreadme
--> Committing changes ...
--> Done
// from the source, wildcards could be a folder and a file
// result: directory includes the folder and the file
$ ./imagebuilder -f Dockerfile.wildcard .
--> FROM alpine as 0
--> COPY ./README* /cp
--> RUN ls -l cp
total 8
-rw-rw-r-- 1 root root 3922 Aug 9 16:41 README.md
drwxrwxr-x 2 root root 4096 Aug 9 17:01 READMEDIR
--> RUN ls -l cp/READMEDIR
total 4
-rw-rw-r-- 1 root root 13 Aug 9 17:01 cpreadme
--> Committing changes ...
--> Done
imagebuildah can determine whether the target should be a single file or a directory if the wildcard is only a file or a folder.
I think the issue is, when wildcards could be a folder and a file, we get result: new directory including the folder and the file. Expect result shoud be :
if target path is not a directory, should report error message, the destinations must ends with a '/'
if target path is a directory, should copy the file under the source folder and the source file
from imagebuilder.
@rhatdan @TomSweeneyRedHat I played with imagebuilder I think the issue does not exist. But found difference between imagebuilder with docker.
Can this issue be closed?
Should I work on a PR to fix the difference between imagebuilder and docker?
from imagebuilder.
What is the difference between imagebuilder and Docker.
from imagebuilder.
What is the difference between imagebuilder and Docker.
from the source, wildcards could be a folder and a file
imagebuilder result: directory includes the folder and the file
docker result: directory includes the content of the folder and the file
imagebuilder allows COPY ./README* /cp
,
docker will return error When using COPY with more than one source file, the destination must be a directory and end with a /, should use COPY ./README* /cp/
$ ./imagebuilder -f Dockerfile.wildcard .
--> FROM alpine as 0
--> COPY ./README* /cp
--> RUN ls -l cp
total 8
-rw-rw-r-- 1 root root 3922 Aug 9 16:41 README.md
drwxrwxr-x 2 root root 4096 Aug 9 17:01 READMEDIR
$ sudo docker build -t wildimg1 -f Dockerfile.wildcard .
Sending build context to Docker daemon 34.28MB
Step 1/3 : FROM alpine
Step 2/3 : COPY ./README* /cp/
Step 3/3 : RUN ls -l cp
total 8
-rw-rw-r-- 1 root root 3922 Aug 9 16:41 README.md
-rw-rw-r-- 1 root root 13 Aug 9 17:01 cpreadme //cpreadme is in the folder READMEDIR
from imagebuilder.
So docker automatically appended the "/" on the end of /cp?
from imagebuilder.
and make sure you're using Docker latest 1.19.+, not Docker 1.13.1
from imagebuilder.
So docker automatically appended the "/" on the end of /cp?
No. without /
in the end, docker stoped after return the message
Step 2/4 : COPY ./README* /tmp/cp
When using COPY with more than one source file, the destination must be a directory and end with a /
[qiwan@qiwan imagebuilder]$
sudo docker -v
Docker version 19.03.1, build 74b1e89
from imagebuilder.
We should do the same. We of course could check if /tmp/cp exists and is a directory then allow the COPY
from imagebuilder.
I think this can be closed. I didn't find the bug as described in this issue (doesn't seem to look at the result of a source wildcard expansion to determine whether the target should be a single file or a directory).
The differences with docker I found #135 (comment) was one of the problems in issue #139. PR #138 is fixing...
from imagebuilder.
Related Issues (20)
- TestDispatchArgDefaultBuiltins is failing on arm/v8 HOT 4
- Regression in ENV expansion HOT 2
- COPY does not handle empty arguments well HOT 3
- Multi-stage Quarkus GraalVM builds do not produce runnable images HOT 5
- COPY --chown does not work right
- ADD should unpack archives HOT 5
- go install github.com/openshift/imagebuilder/cmd/[email protected] failed HOT 2
- Imagebuilder gets stuck while copying content between stages with --chown for a user with specific UID HOT 2
- Does imagebuilder support concurrent building? HOT 5
- issue in COPY from one stage to next HOT 8
- ENV does not inherit through multiple layers
- [Feature] Add --keep-ownership option to add/copy commands to keep file ownership. HOT 4
- dockerclient quietly ignores the --chmod flag for ADD/COPY HOT 3
- COPY tarball treats destination as directory
- Imagebuilder expands `ARGS` which are not declared HOT 3
- BUG: labels following missing line-continuation character are ignored HOT 7
- LCOWSupported method is not available in newer docker libs HOT 4
- Build image failed without docker HOT 5
- TestDispatchFromFlagsAndUseBuiltInArgs fails on arm HOT 4
- Generic way to build the first stage
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from imagebuilder.