Dockerfile problem with Miniconda on ARM64 MacOS - docker

I have a Dockerfile and want to install Miniconda using the following lines:
# installing conda
RUN wget https://repo.anaconda.com/miniconda/Miniconda3-latest-MacOSX-arm64.sh -O ~/miniconda.sh && bash ~/miniconda.sh -b -p $HOME/miniconda3 -b
ENV PATH=/$HOME/miniconda3/bin:$PATH
RUN conda update -y conda \
&& rm miniconda.sh
However, this fails with the following error:
#14 0.802 2023-02-17 21:52:22 (67.5 MB/s) - '/root/miniconda.sh' saved [43758576/43758576]
#14 0.802
#14 0.812 PREFIX=/root/miniconda3
#14 0.817 /root/miniconda.sh: line 313: md5: command not found
------
executor failed running [/bin/sh -c wget https://repo.anaconda.com/miniconda/Miniconda3-latest-MacOSX-arm64.sh -O ~/miniconda.sh && bash ~/miniconda.sh -b -p $HOME/miniconda3 -b]: exit code: 127
Apparently, md5 is missing. I tried to add this via brew which seems to complete, but it then still fails with the md5 error.
# installing brew & md5sha1sum
RUN /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" \
RUN brew install md5sha1sum
UPDATE
I changed the Dockerfile (making use of CMD instead of RUN and creating a symbolic link to md5) and now it works.
RUN wget https://repo.anaconda.com/miniconda/Miniconda3-latest-MacOSX-arm64.sh
CMD ["sudo ln -s md5sum /bin/md5"]
CMD ["chmod +x Miniconda3-latest-MacOSX-arm64.sh"]
CMD ["./Miniconda3-latest-MacOSX-arm64.sh -b -p $HOME/miniconda3 -b"]
ENV PATH=/$HOME/miniconda3/bin:$PATH
CMD ["conda update -y conda"]
RUN rm Miniconda3-latest-MacOSX-arm64.sh

Related

Can't compile Rust project in conda environment in Docker

I'm trying to build the following sightglass benchmarking suite/ Dockerfile:
FROM ubuntu:22.04
RUN echo 'APT::Install-Suggests "0";' >> /etc/apt/apt.conf.d/00-docker
RUN echo 'APT::Install-Recommends "0";' >> /etc/apt/apt.conf.d/00-docker
RUN DEBIAN_FRONTEND=noninteractive \
apt-get update \
&& apt-get install -y python3 \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /usr/src
ADD rust-benchmark rust-benchmark
WORKDIR /usr/src/rust-benchmark
RUN apt update --yes
RUN apt install clang lldb lld wget curl git xz-utils bzip2 --yes
RUN apt-get install --reinstall ca-certificates --yes
RUN apt-get install libgl1-mesa-glx libegl1-mesa libxrandr2 libxrandr2 libxss1 libxcursor1 libxcomposite1 libasound2 libxi6 libxtst6 -y
RUN mkdir /usr/local/share/ca-certificates/cacert.org
RUN wget -P /usr/local/share/ca-certificates/cacert.org http://www.cacert.org/certs/root.crt http://www.cacert.org/certs/class3.crt
RUN update-ca-certificates
RUN git config --global http.sslCAinfo /etc/ssl/certs/ca-certificates.crt
RUN wget https://repo.anaconda.com/archive/Anaconda3-2022.10-Linux-x86_64.sh --no-check-certificate
RUN cd / && find . -name cargo
RUN chmod +x Anaconda3-2022.10-Linux-x86_64.sh
RUN yes yes | ./Anaconda3-2022.10-Linux-x86_64.sh
RUN rm Anaconda3-2022.10-Linux-x86_64.sh
RUN echo "export PATH=./yes/bin:$PATH" >> ~/.bashrc
ENV CONDA ./yes/bin/
ENV PATH="${CONDA}:${PATH}"
RUN ln -s ./yes/bin/conda /usr/local/bin/conda
RUN eval $(conda shell.bash hook)
RUN conda init bash
RUN conda update --all
RUN cd / && find . -name cargo
RUN conda create -c conda-forge -n rustenv rust
RUN activate rustenv
SHELL ["./yes/bin/conda", "run", "-n", "rustenv", "/bin/bash", "-c"]
RUN rustc --version
ENV GIT_SSL_NO_VERIFY=1
RUN git clone https://github.com/emscripten-core/emsdk.git
RUN cd emsdk && git pull
RUN chmod +x ./emsdk/emsdk
RUN ./emsdk/emsdk install latest
RUN ./emsdk/emsdk activate latest
RUN chmod +x ./emsdk/emsdk_env.sh
RUN rm /bin/sh && ln -s /bin/bash /bin/sh
RUN cd emsdk && source ./emsdk_env.sh
RUN ./emsdk/emsdk_env.sh
ENV EMSDK ./emsdk
ENV EMSCRIPTEN=${EMSDK}/emscripten/sdk
ENV EM_DATA ${EMSDK}/.data
ENV EM_CONFIG ${EMSDK}/.emscripten
ENV EM_CACHE ${EM_DATA}/cache
ENV EM_PORTS ${EM_DATA}/ports
ENV PATH="${EMSDK}:${EMSDK}/emscripten/sdk:${EMSDK}/llvm/clang/bin:${EMSDK}/node/current/bin:${EMSDK}/binaryen/bin:${PATH}"
RUN curl https://sh.rustup.rs -ksSf | sh -s -- -y
RUN chmod +x $HOME/.cargo/env
RUN $HOME/.cargo/env
ENV RUST ~/.cargo/bin
ENV PATH="${RUST}:${PATH}"
RUN rustup default nightly
RUN rustup target add wasm32-wasi --toolchain nightly
RUN ./yes/envs/rustenv/bin/cargo build --release --target wasm32-wasi
RUN cp target/wasm32-wasi/release/bls-381-wasm-benchmark.wasm /benchmark.wasm
The build process always aborts on the compile step with the following error:
error[E0463]: can't find crate for `core`
|
= note: the `wasm32-wasi` target may not be installed
= help: consider downloading the target with `rustup target add wasm32-wasi`
error[E0463]: can't find crate for `compiler_builtins`
My full setup can be found here: https://github.com/achimcc/arkworks-wasmtime-benchmarks/tree/main/benchmarks/bls12-381
It seems you are compiling something whose target is wasm32-wasi.
Rust can compile source codes for different "targets", but only few of them was enabled by default.
To install the wasm32-wasi target, you can run this command:
rustup target add wasm32-wasi
Any other questions about compling or environments, feel easy to comment here.

conda: not found - Docker container do not run export PATH=~/miniconda3/bin:$PATH

I have the following Dockerfile:
FROM --platform=linux/x86_64 nvidia/cuda:11.7.0-devel-ubuntu20.04
COPY app ./app
ARG DEBIAN_FRONTEND=noninteractive
RUN apt-get update && apt-get -y upgrade && apt-get install -y apt-utils
RUN apt-get install -y \
net-tools iputils-ping \
build-essential cmake git \
curl wget vim \
zip p7zip-full p7zip-rar \
imagemagick ffmpeg \
libomp5
# RUN wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh
COPY Miniconda3-latest-Linux-x86_64.sh .
RUN chmod guo+x Miniconda3-latest-Linux-x86_64.sh
RUN bash Miniconda3-latest-Linux-x86_64.sh -b -p ~/miniconda3
RUN export PATH=~/miniconda3/bin:$PATH
RUN conda --version
RUN conda update -n base conda
RUN conda create -y --name servier python=3.6
RUN conda activate servier
RUN conda install -c conda-forge rdkit
CMD ["bash"]
When I run: docker image build -t image_test_cuda2 . it breaks in the RUN conda --version.
The error is RUN conda --version: ... /bin/sh: 1: conda: not found. The problem is that RUN export PATH=~/miniconda3/bin:$PATH is not working. It is not creating conda link in the PATH.
If I build the image until RUN bash Miniconda3-latest-Linux-x86_64.sh -b -p ~/miniconda3 and manually I get access to the container using docker exec -it <id> /bin/bash and then from the #/ manually I run the same command #/export PATH=~/miniconda3/bin:$PATH it works good. If I manually run the next command inside the container RUN conda update -n base conda it works good.
The conclusion is that it seems that the command RUN export PATH=~/miniconda3/bin:$PATH is not working in Dockerfile - docker image build. How to solve this issue?

makefile:513: pod/perlintern.pod Segmentation fault (core dumped) When installing specific perl version in dockerfile

I am trying to install perl 5.12.3 onto a Fedora 33 Docker image in my dockerfile however when I attempt to build the image I am faced with this error:
/bin/sh: line 1: /dev/tty: No such device or address
make[1]: Leaving directory '/'
make[1]: [makefile:964: minitest] Error 1 (ignored)
./miniperl -Ilib autodoc.pl
make: *** [makefile:513: pod/perlintern.pod] Segmentation fault (core dumped)
This is how I am attempting to install it:
RUN wget https://www.cpan.org/authors/id/R/RJ/RJBS/perl-5.12.3.tar.gz
RUN tar -xzf perl-5.12.3.tar.gz
RUN perl-5.12.3/Configure -Dmksymlinks -des -Dprefix=/usr/local/ -d y &&\
make && \
make test && \
make install
RUN perl -v
I guess that the problem is that docker is running the build context with no stdin or tty. Does anyone know a fix for this? I tried to install perlbrew instead to accomplish this but that was already proving to have quite a few of its own issues. Thank you for any help or advice. I am open to any other methods to installing perl 5.12.3 in the image.
I was able to install Perl version 5.12.4 with perlbrew like this (building fedora:33 docker image from my Ubuntu 21.04 laptop):
Dockerfile:
FROM fedora:33
SHELL ["/bin/bash", "-c"]
RUN yum -y update \
&& yum -y install gcc gcc-c++ make curl \
vim wget zlib-devel openssl-devel bzip2 patch \
perl-CPAN perl-App-cpanminus
ARG user=root
ARG home=/$user
WORKDIR $home
USER $user
COPY entrypoint.sh .
RUN chmod +x entrypoint.sh
ENTRYPOINT ["./entrypoint.sh"]
entrypoint.sh:
curl -L https://install.perlbrew.pl | SHELL=/bin/bash bash
echo 'export PERLBREW_ROOT=$HOME/perl5/perlbrew' >> .bashrc
echo 'source $PERLBREW_ROOT/etc/bashrc' >> .bashrc
export PERLBREW_ROOT=$HOME/perl5/perlbrew
source $PERLBREW_ROOT/etc/bashrc
perlbrew install --notest --noman perl-5.12.4
perlbrew install-cpanm
perlbrew switch perl-5.12.4
perl --version
exec bash

Getting an error with Chromedriver using docker

Below are details of the Docker file:
FROM python:3
RUN python3 -m pip install robotframework==3.0.4
RUN python3 -m pip install robotframework-seleniumlibrary==3.2.0
RUN python3 -m pip install selenium==3.14.0
# Install Chrome for Selenium
RUN curl https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb -o /chrome.deb
RUN dpkg -i /chrome.deb || apt-get install -yf
RUN rm /chrome.deb
# Install chromedriver for Selenium
RUN curl https://chromedriver.storage.googleapis.com/2.42/chromedriver_linux64.zip -o /usr/local/bin/chromedriver
RUN unzip -o /usr/local/bin/chromedriver -d /usr/local/bin
RUN chmod 777 /usr/local/bin/chromedriver
After that, executed below commands:
sudo docker build -t rb/robot-docker
sudo docker run -ti -v /home/Automation:/usr/src/project rb/robot-docker bash
root> cd /usr/src/project
root> robot sample-0-trivial/sample-0-trivial.txt
It gives the error message as:
"WebDriverException: Message: Service chromedriver unexpectedly exited. Status code was: 127"

Golang docker with cloud foundry CLI

I use the following dockerfile and when I build and run it I got error that **unknown command cf**, I set the env and I expected that when I run cf -v it will print the version,what it could be ?
FROM golang:1.10.5
ENV CF_CLI_VERSION "6.40.0"
RUN ln -s /lib/ /lib64
RUN apt-get update && apt-get install curl -y
ENV CF_HOME=/usr/local/bin
RUN curl -L "https://cli.run.pivotal.io/stable?release=linux64-binary&version=${CF_CLI_VERSION}" | tar -zx -C /usr/local/
You probably want to change the last line to
RUN curl -L "https://cli.run.pivotal.io/stable?release=linux64-binary&version=${CF_CLI_VERSION}" | tar -zx -C /usr/local/bin
/usr/local is not in the PATH by default

Resources