skip to Main Content

I’m running this Docker file in MAC M1:

Dockerfile

ARG VARIANT=16-bullseye
FROM mcr.microsoft.com/vscode/devcontainers/javascript-node:0-${VARIANT}
RUN apt-get update && export DEBIAN_FRONTEND=noninteractive 
    && apt-get -y install --no-install-recommends vim wget redis-tools

ARG MONGO_CLI_VERSION=4.4
RUN wget -qO - https://www.mongodb.org/static/pgp/server-${MONGO_CLI_VERSION}.asc | sudo apt-key add -
RUN echo "deb http://repo.mongodb.org/apt/debian buster/mongodb-org/${MONGO_CLI_VERSION} main" | tee /etc/apt/sources.list.d/mongodb-org-${MONGO_CLI_VERSION}.list
RUN apt-get update && export DEBIAN_FRONTEND=noninteractive 
    && apt-get -y install --no-install-recommends mongodb-mongosh 
    && apt-get clean -y && rm -rf /var/lib/apt/lists/*

RUN wget https://fastdl.mongodb.org/tools/db/mongodb-database-tools-debian11-x86_64-100.5.3.deb
RUN apt install ./mongodb-database-tools-*-100.5.3.deb

RUN su node -c "wget -O ~/.git-completion.bash https://raw.githubusercontent.com/git/git/master/contrib/completion/git-completion.bash"
RUN su node -c "echo -e 'n# Git Completion' >> ~/.bashrc"
RUN su node -c "echo -e 'source ~/.git-completion.bashn' >> ~/.bashrc"

The response is shown in the image attached.
enter image description here

2

Answers


  1. Try another platform for example x86_64

    https://docs.docker.com/desktop/mac/apple-silicon/

    Not all images are available for ARM64 architecture. You can add
    –platform linux/amd64 to run an Intel image under emulation

    Login or Signup to reply.
  2. On this line:

    RUN wget https://fastdl.mongodb.org/tools/db/mongodb-database-tools-debian11-x86_64-100.5.3.deb
    

    You’re trying to install a package named mongodb-database-tools-debian11-x86_64-100.5.3.deb that is for Intel processors (x64_64) in your ARM64 image. That’s not going to work.

    MongoDB doesn’t seem to offer a package for Debian on ARM64 on their download page. They do offer one for Ubuntu ARM64.

    There doesn’t seem to be a variant of javascript-node that builds on Ubuntu 18 Bionic, however, I think you can keep on using this Debian 11 Bullseye variant, because the version of MongoDB-database-tools for Ubuntu 16 seems to install just fine:

    RUN wget https://fastdl.mongodb.org/tools/db/mongodb-database-tools-ubuntu1604-arm64-100.5.3.deb
    

    Build the image and test:

    docker build -t test . ; docker run --rm test mongodump --version
    
    mongodump version: 100.5.3
    git version: 139703c0587796da96c367f365473d0266f9cede
    Go version: go1.17.10
       os: linux
       arch: arm64
       compiler: gc
    

    If you want this image to build on both x86 and ARM, check what architecture you’re on before downloading the .deb:

    RUN if [ "$(arch)" = "aarch64" ] || [ "$(arch)" = "arm64" ]; then
        wget https://fastdl.mongodb.org/tools/db/mongodb-database-tools-ubuntu1604-arm64-100.5.3.deb;
      else
        wget https://fastdl.mongodb.org/tools/db/mongodb-database-tools-debian11-x86_64-100.5.3.deb;
      fi;
    RUN apt install ./mongodb-database-tools-*-100.5.3.deb
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search