-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Docker build is not recognising the -e
flag for the echo command
#4954
Comments
Hi, I would like to work on this, is there a good place to start? |
I'm not able to reproduce this issue using docker build -t foo -<<'EOF'
FROM alpine
RUN echo -e "BEGINNING OF FILE\n\n" > .tmpfile
EOF Build runs successfully; [+] Building 1.5s (7/7) FINISHED docker:desktop-linux
=> [internal] load build definition from Dockerfile 0.0s
=> => transferring dockerfile: 96B 0.0s
=> [internal] load metadata for docker.io/library/alpine:latest 0.0s
=> [internal] load .dockerignore 0.0s
=> => transferring context: 2B 0.0s
=> [1/2] FROM docker.io/library/alpine:latest@sha256:c5b1261d6d3e43071626931fc004f70149baeba2c8ec672bd4f27761f8e1ad6b 1.2s
=> => resolve docker.io/library/alpine:latest@sha256:c5b1261d6d3e43071626931fc004f70149baeba2c8ec672bd4f27761f8e1ad6b 1.2s
=> [auth] library/alpine:pull token for registry-1.docker.io 0.0s
=> [2/2] RUN echo -e "BEGINNING OF FILE\n\n" > .tmpfile 0.1s
=> exporting to image 0.1s
=> => exporting layers 0.0s
=> => exporting manifest sha256:07e9b08ca1e01a821c0779ed887a2ad47622da64c8bd558c757ada84bfdb97ab 0.0s
=> => exporting config sha256:e8769b3ba4c8f5e05d3c2b38644985cc74fb123b221a79fd99635b7663815811 0.0s
=> => exporting attestation manifest sha256:c93bcc769d1be9eca9549c10fe9828a49f922e8abc2c7423cbf6a5ff719b8c99 0.0s
=> => exporting manifest list sha256:97cab80709c4b973b084d9066f472d9dd242a395646bc6f9dfcfc0099b4f0fd3 0.0s
=> => naming to docker.io/library/foo:latest 0.0s
=> => unpacking to docker.io/library/foo:latest 0.0s And checking the file shows the expected content; docker run --rm foo cat /.tmpfile
BEGINNING OF FILE
However, the |
I just came across this, too, using Ubuntu 22.04 base image. The build is run in a standard So, at least for my case, I just omitted the |
Description
I'm not sure how to categorise this but it seems like unexpected behaviour. I'm running a simple command such as
echo -e "BEGINNING OF FILE\n\n" > .tmpfile
When I run this from the docker image it outputs as expected. When I run this within a 'RUN' command in the Dockerfile it outputs the '-e' flag as part of the output e.g. "-e BEGINNING OF FILE".
I have no idea why it's outputting the -e flag directly.
Reproduce
Add this step to the Docker file:
Expected behavior
The output should be:
But is actually:
docker version
Client: Docker Engine - Community Version: 25.0.3 API version: 1.44 Go version: go1.21.6 Git commit: 4debf41 Built: Tue Feb 6 21:13:09 2024 OS/Arch: linux/amd64 Context: default Server: Docker Engine - Community Engine: Version: 25.0.3 API version: 1.44 (minimum version 1.24) Go version: go1.21.6 Git commit: f417435 Built: Tue Feb 6 21:13:09 2024 OS/Arch: linux/amd64 Experimental: false containerd: Version: 1.6.28 GitCommit: ae07eda36dd25f8a1b98dfbf587313b99c0190bb runc: Version: 1.1.12 GitCommit: v1.1.12-0-g51d5e94 docker-init: Version: 0.19.0 GitCommit: de40ad0
docker info
Additional Info
No response
The text was updated successfully, but these errors were encountered: