Hello,
I read the docs for a while now and saw also the examples.
Well, quite impressive, how a tiny dockerfile can create a powerfull application.
But for complete beginners far to overloaded. Database, webserver, php, accessing by browser, and and and.
So I tried to create a very simple Dockerfile on my own, but it did not work.
The goal is: Just derive a image from debian and execute a uname -a in it.
Watch the terminal output, look for the version.
Here is the Dockerfile:
# syntax=docker/dockerfile:1
# syntaxdirektive
# take a debian inside container
FROM debian
# install uname
RUN apt-get install coreutils
# execute the command
CMD ["uname -a"]
It builds:
docker buildx build .
[+] Building 2.3s (8/8) FINISHED docker:default
=> [internal] load build definition from Dockerfile 0.1s
=> => transferring dockerfile: 220B 0.0s
=> resolve image config for docker-image://docker.io/docker/dockerfile:1 0.9s
=> CACHED docker-image://docker.io/docker/dockerfile:1@sha256:9857836c9e 0.0s
=> [internal] load metadata for Docker Hub Container Image Library | App Containerization 0.7s
=> [internal] load .dockerignore 0.1s
=> => transferring context: 2B 0.0s
=> [1/2] FROM Docker Hub Container Image Library | App Containerization 0.0s
=> CACHED [2/2] RUN apt-get install coreutils 0.0s
=> exporting to image 0.0s
=> => exporting layers 0.0s
=> => writing image sha256:b2da8c793cb600406673dc39b00158b3391eb20c36249 0.0s
but running it throws an error:
> docker run b2da8c793cb600406673dc39b00158b3391eb20c36249
docker: Error response from daemon: failed to create task for container: failed to create shim task: OCI runtime create failed: runc create failed: unable to start container process: error during container init: exec: "uname -a": executable file not found in $PATH
Run 'docker run --help' for more information
So, what’s wrong here?
regards