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

Image Creation Fails on step 17 with error: Build command failed with error: DEPRECATED: The legacy builder is deprecated and will be removed in a future release. Install the buildx component to build images with BuildKit: https://docs.docker.com/go/buildx/ COPY failed: file not found in build context or excluded by .dockerignore: stat Web: file does not exist #519

Open
Bisonfan95 opened this issue Dec 27, 2024 · 6 comments

Comments

@Bisonfan95
Copy link

Currently Working on Arch Linux, specifically on Steam Deck Beta Branch. It doesn't work either with a local user with Java Home properly Set and added to the docker group of users nor with the SUDO command.

image

How to reproduce:

Run this command on the imagetool/bin folder after adding proper JDK and WLS installer: ./imagetool.sh create --tag wls:12.2.1.4.0 --version 12.2.1.4.0

@ddsharpe
Copy link
Member

ddsharpe commented Jan 2, 2025

@Bisonfan95 Can you let me know what happens when you run imagetool.sh on your environment if you add the platform option to the command line? This flag forces Image Tool to use buildx. For example:
./imagetool.sh create --tag wls:12.2.1.4.0 --version 12.2.1.4.0 --platform linux/amd64

@Bisonfan95
Copy link
Author

Bisonfan95 commented Jan 2, 2025

@Bisonfan95 Can you let me know what happens when you run imagetool.sh on your environment if you add the platform option to the command line? This flag forces Image Tool to use buildx. For example: ./imagetool.sh create --tag wls:12.2.1.4.0 --version 12.2.1.4.0 --platform linux/amd64

I tried it before already, the script seems to be passing wrong parameters for docker. It doesn't recognize "--force-rm". I get this Output:

./imagetool.sh create --tag wls:12.2.1.4.0 --version 12.2.1.4.0 --platform linux/amd64
[INFO ] WebLogic Image Tool version 1.14.3
[INFO ] Image Tool build ID: 496af18e-195e-443a-aa01-d9edbbf9590b
[INFO ] Temporary directory used for image build context: /home/deck/wlsimgbuilder_temp4092880907692071294
[INFO ] Copying /home/deck/Downloads/jdk-8u202-linux-x64.tar.gz to build context folder.
[INFO ] Using middleware installers (wls) version 12.2.1.4.0
[INFO ] Copying /home/deck/Downloads/Web Logic and Coherence.zip to build context folder.
[INFO ] Starting build: docker buildx build --force-rm --tag wls:12.2.1.4.0 --platform linux/amd64 /home/deck/wlsimgbuilder_temp4092880907692071294
[SEVERE ] Build command failed with error: unknown flag: --force-rm
See 'docker --help'.

Usage: docker [OPTIONS] COMMAND

A self-sufficient runtime for containers

Common Commands:
run Create and run a new container from an image
exec Execute a command in a running container
ps List containers
build Build an image from a Dockerfile
pull Download an image from a registry
push Upload an image to a registry
images List images
login Log in to a registry
logout Log out from a registry
search Search Docker Hub for images
version Show the Docker version information
info Display system-wide information

Management Commands:
builder Manage builds
container Manage containers
context Manage contexts
image Manage images
manifest Manage Docker image manifests and manifest lists
network Manage networks
plugin Manage plugins
system Manage Docker
trust Manage trust on Docker images
volume Manage volumes

Swarm Commands:
swarm Manage Swarm

Commands:
attach Attach local standard input, output, and error streams to a running container
commit Create a new image from a container's changes
cp Copy files/folders between a container and the local filesystem
create Create a new container
diff Inspect changes to files or directories on a container's filesystem
events Get real time events from the server
export Export a container's filesystem as a tar archive
history Show the history of an image
import Import the contents from a tarball to create a filesystem image
inspect Return low-level information on Docker objects
kill Kill one or more running containers
load Load an image from a tar archive or STDIN
logs Fetch the logs of a container
pause Pause all processes within one or more containers
port List port mappings or a specific mapping for the container
rename Rename a container
restart Restart one or more containers
rm Remove one or more containers
rmi Remove one or more images
save Save one or more images to a tar archive (streamed to STDOUT by default)
start Start one or more stopped containers
stats Display a live stream of container(s) resource usage statistics
stop Stop one or more running containers
tag Create a tag TARGET_IMAGE that refers to SOURCE_IMAGE
top Display the running processes of a container
unpause Unpause all processes within one or more containers
update Update configuration of one or more containers
wait Block until one or more containers stop, then print their exit codes

Global Options:
--config string Location of client config files (default
"/home/deck/.docker")
-c, --context string Name of the context to use to connect to the
daemon (overrides DOCKER_HOST env var and
default context set with "docker context use")
-D, --debug Enable debug mode
-H, --host list Daemon socket to connect to
-l, --log-level string Set the logging level ("debug", "info",
"warn", "error", "fatal") (default "info")
--tls Use TLS; implied by --tlsverify
--tlscacert string Trust certs signed only by this CA (default
"/home/deck/.docker/ca.pem")
--tlscert string Path to TLS certificate file (default
"/home/deck/.docker/cert.pem")
--tlskey string Path to TLS key file (default
"/home/deck/.docker/key.pem")
--tlsverify Use TLS and verify the remote
-v, --version Print version information and quit

Run 'docker COMMAND --help' for more information on a command.

For more help on how to use Docker, head to https://docs.docker.com/go/guides/

@ddsharpe
Copy link
Member

ddsharpe commented Jan 3, 2025

--force-rm seems to work for me. Which OS and which version of Docker are you using?

build $ docker buildx build --force-rm --tag t:1 .                                                                                                                    
[+] Building 0.3s (6/6) FINISHED                                                                                                                                               
 => [internal] load .dockerignore                                                                                                                                         0.0s
 => => transferring context: 2B                                                                                                                                           0.0s
 => [internal] load build definition from Dockerfile                                                                                                                      0.0s
 => => transferring dockerfile: 67B                                                                                                                                       0.0s
 => [internal] load metadata for docker.io/library/alpine:latest                                                                                                          0.2s
 => [1/2] FROM docker.io/library/alpine:latest@sha256:21dc6063fd678b478f57c0e13f47560d0ea4eeba26dfc947b2a4f81f686b9f45                                                    0.0s
 => CACHED [2/2] RUN ls /                                                                                                                                                 0.0s
 => exporting to image                                                                                                                                                    0.0s
 => => exporting layers                                                                                                                                                   0.0s
 => => writing image sha256:46c158bc6b7781f64cf35340e46062bf19af9844f66d08668e61d5f30ed612a3                                                                              0.0s
 => => naming to docker.io/library/t:1                                                                                                                                    0.0s
build $ docker --version
Docker version 27.4.0, build bde2b89313

@ddsharpe
Copy link
Member

ddsharpe commented Jan 3, 2025

Just so that we can get to the original question, can you add --skipcleanup to the command line in order to disable --force-rm.

./imagetool.sh create --tag wls:12.2.1.4.0 --version 12.2.1.4.0 --platform linux/amd64 --skipcleanup

@Bisonfan95
Copy link
Author

Just so that we can get to the original question, can you add --skipcleanup to the command line in order to disable --force-rm.

./imagetool.sh create --tag wls:12.2.1.4.0 --version 12.2.1.4.0 --platform linux/amd64 --skipcleanup

Hello! My OS is Arch Linux, kernel version: 6.5.0-valve22-1-neptune-65-g9a338ed8a75e (64-bit) and my docker version is: 25.0.2

I managed to install buildx for docker to avoid using the deprecated builder. I added what you asked and this is my output (thanks for helping):

./imagetool.sh create --tag wls:12.2.1.4.0 --version 12.2.1.4.0 --platform linux/amd64 --skipcleanup
[INFO ] WebLogic Image Tool version 1.14.3
[INFO ] Image Tool build ID: fc53658d-e677-4e50-9761-10c43108cfc6
[INFO ] Temporary directory used for image build context: /home/deck/wlsimgbuilder_temp3610158571058552241
[INFO ] Copying /home/deck/Downloads/jdk-8u202-linux-x64.tar.gz to build context folder.
[INFO ] Using middleware installers (wls) version 12.2.1.4.0
[INFO ] Copying /home/deck/Downloads/Web Logic and Coherence.zip to build context folder.
[INFO ] Starting build: docker buildx build --tag wls:12.2.1.4.0 --platform linux/amd64 /home/deck/wlsimgbuilder_temp3610158571058552241
[SEVERE ] Build command failed with error: unknown flag: --tag
See 'docker --help'.

Usage: docker [OPTIONS] COMMAND

A self-sufficient runtime for containers

Common Commands:
run Create and run a new container from an image
exec Execute a command in a running container
ps List containers
build Build an image from a Dockerfile
pull Download an image from a registry
push Upload an image to a registry
images List images
login Log in to a registry
logout Log out from a registry
search Search Docker Hub for images
version Show the Docker version information
info Display system-wide information

Management Commands:
builder Manage builds
buildx* Docker Buildx (Docker Inc., v0.19.3)
container Manage containers
context Manage contexts
image Manage images
manifest Manage Docker image manifests and manifest lists
network Manage networks
plugin Manage plugins
system Manage Docker
trust Manage trust on Docker images
volume Manage volumes

Swarm Commands:
swarm Manage Swarm

Commands:
attach Attach local standard input, output, and error streams to a running container
commit Create a new image from a container's changes
cp Copy files/folders between a container and the local filesystem
create Create a new container
diff Inspect changes to files or directories on a container's filesystem
events Get real time events from the server
export Export a container's filesystem as a tar archive
history Show the history of an image
import Import the contents from a tarball to create a filesystem image
inspect Return low-level information on Docker objects
kill Kill one or more running containers
load Load an image from a tar archive or STDIN
logs Fetch the logs of a container
pause Pause all processes within one or more containers
port List port mappings or a specific mapping for the container
rename Rename a container
restart Restart one or more containers
rm Remove one or more containers
rmi Remove one or more images
save Save one or more images to a tar archive (streamed to STDOUT by default)
start Start one or more stopped containers
stats Display a live stream of container(s) resource usage statistics
stop Stop one or more running containers
tag Create a tag TARGET_IMAGE that refers to SOURCE_IMAGE
top Display the running processes of a container
unpause Unpause all processes within one or more containers
update Update configuration of one or more containers
wait Block until one or more containers stop, then print their exit codes

Global Options:
--config string Location of client config files (default
"/home/deck/.docker")
-c, --context string Name of the context to use to connect to the
daemon (overrides DOCKER_HOST env var and
default context set with "docker context use")
-D, --debug Enable debug mode
-H, --host list Daemon socket to connect to
-l, --log-level string Set the logging level ("debug", "info",
"warn", "error", "fatal") (default "info")
--tls Use TLS; implied by --tlsverify
--tlscacert string Trust certs signed only by this CA (default
"/home/deck/.docker/ca.pem")
--tlscert string Path to TLS certificate file (default
"/home/deck/.docker/cert.pem")
--tlskey string Path to TLS key file (default
"/home/deck/.docker/key.pem")
--tlsverify Use TLS and verify the remote
-v, --version Print version information and quit

Run 'docker COMMAND --help' for more information on a command.

For more help on how to use Docker, head to https://docs.docker.com/go/guides/

@ddsharpe
Copy link
Member

ddsharpe commented Jan 6, 2025

I believe that there is something in your environment that is causing these issues. --tag has been a valid command line option for Docker build and buildx since their initial releases. --force-rm is no longer documented, but is still a valid option in every Docker client I tried (community, Rancher Desktop, RedHat 7 and 8 clients, ...). We can remove the --force-rm in an upcoming release, or at least make it optional. But for --tag, you are going to need to figure out what is happening in your environment.
Ideas I would try:

  • Retype the image tool command manually without cut and paste (maybe there is an invisible control character on the text being copied)
  • Update the docker client and engine to the latest version.
  • Using imagetool options --dryRun --skipcleanup, generate the Docker context folder and the docker build command. Change directory to the context folder with the generated Dockerfile, and execute the docker command on the command line. The stdout of imagetool will show you the info you need. The goal is to troubleshoot the docker command in your envionment. For example, is docker in your environment an alias or shell script that is causing the issue with token parsing, or quotes, or ... Does docker recognize the --tag option this way?
...
[INFO ] Temporary directory used for image build context: /home/deck/wlsimgbuilder_temp3610158571058552241
...
[INFO ] Starting build: docker buildx build --tag wls:12.2.1.4.0 --platform linux/amd64 /home/deck/wlsimgbuilder_temp3610158571058552241

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants