It could be that I missed something obvious, but sometimes when I build my image it succeeds, and most times, it fails with different error messages.
Here is my Dockerfile
FROM mcr.microsoft.com/devcontainers/base:ubuntu-22.04
# Set the environment variables
ENV DEBIAN_FRONTEND=noninteractive
# Install the curl and build-essential packages
RUN apt-get update && \
apt-get install -y curl build-essential && \
apt-get clean
# Install Rust using rustup
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
Here is the 1st error
> docker build -t rust_install .
failed to fetch metadata: fork/exec /usr/local/lib/docker/cli-plugins/docker-buildx: no such file or directory
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/
Sending build context to Docker daemon 5.12kB
Step 1/7 : FROM mcr.microsoft.com/devcontainers/base:ubuntu-22.04
---> c1decbdf2125
Step 2/7 : ENV DEBIAN_FRONTEND=noninteractive
---> Using cache
---> a3f95d3bf5ac
Step 3/7 : RUN apt-get update && apt-get install -y curl build-essential && apt-get clean
---> Using cache
---> 119dcf89be23
Step 4/7 : RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
---> Running in 59cb2a15bdaa
info: downloading installer
info: profile set to 'default'
info: default host triple is x86_64-unknown-linux-gnu
info: syncing channel updates for 'stable-x86_64-unknown-linux-gnu'
info: latest update on 2024-05-02, rust version 1.78.0 (9b00956e5 2024-04-29)
info: downloading component 'cargo'
info: downloading component 'clippy'
info: downloading component 'rust-docs'
error: component download failed for rust-docs-x86_64-unknown-linux-gnu: error decoding response body
The command '/bin/sh -c curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y' returned a non-zero code: 1
Here is the 2nd error
> docker build -t rust_install .
failed to fetch metadata: fork/exec /usr/local/lib/docker/cli-plugins/docker-buildx: no such file or directory
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/
Sending build context to Docker daemon 5.12kB
Step 1/7 : FROM mcr.microsoft.com/devcontainers/base:ubuntu-22.04
---> c1decbdf2125
Step 2/7 : ENV DEBIAN_FRONTEND=noninteractive
---> Using cache
---> a3f95d3bf5ac
Step 3/7 : RUN apt-get update && apt-get install -y curl build-essential && apt-get clean
---> Using cache
---> 119dcf89be23
Step 4/7 : RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
---> Running in 43c5ecca2867
info: downloading installer
curl: (56) OpenSSL SSL_read: Connection reset by peer, errno 104
rustup: command failed: downloader https://static.rust-lang.org/rustup/dist/x86_64-unknown-linux-gnu/rustup-init /tmp/tmp.tXyodXsMJ7/rustup-init x86_64-unknown-linux-gnu
The command '/bin/sh -c curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y' returned a non-zero code: 1
Later on I will use this as a dev container.
How would you make this Dockerfile ?