M
Modular•14mo ago
Logan

Docker Container Issues

I've been trying to build a docker container for a while and I'm not sure what I'm doing wrong. No matter what I do I get something like this on the install mojo command. Any ideas?
=> ERROR [ 5/10] RUN modular install mojo 0.2s
------
> [ 5/10] RUN modular install mojo:
0.186 modular: error: Could not open cache index 0 size: No such file or directory
------
Dockerfile:26
--------------------
24 |
25 | RUN curl https://get.modular.com | MODULAR_AUTH=AUTHKEYHERE sh -
26 | >>> RUN modular install mojo
27 |
28 | ARG MODULAR_HOME="/root/.modular"
--------------------
ERROR: failed to solve: process "/bin/sh -c modular install mojo" did not complete successfully: exit code: 1
=> ERROR [ 5/10] RUN modular install mojo 0.2s
------
> [ 5/10] RUN modular install mojo:
0.186 modular: error: Could not open cache index 0 size: No such file or directory
------
Dockerfile:26
--------------------
24 |
25 | RUN curl https://get.modular.com | MODULAR_AUTH=AUTHKEYHERE sh -
26 | >>> RUN modular install mojo
27 |
28 | ARG MODULAR_HOME="/root/.modular"
--------------------
ERROR: failed to solve: process "/bin/sh -c modular install mojo" did not complete successfully: exit code: 1
3 Replies
Logan
LoganOP•14mo ago
Here is the file I was attempting to build
# Use Ubuntu 20.04 as the base image
FROM ubuntu:20.04

ARG DEFAULT_TZ=America/Los_Angeles
ENV DEFAULT_TZ=$DEFAULT_TZ

RUN apt-get update \
&& DEBIAN_FRONTEND=noninteractive TZ=$DEFAULT_TZ apt-get install -y \
tzdata \
vim \
nano \
sudo \
curl \
wget \
git && \
rm -rf /var/lib/apt/lists/*

# Download the latest version of minicoda py3.8 for linux x86/x64.
RUN curl -fsSL https://repo.anaconda.com/miniconda/$( wget -O - https://repo.anaconda.com/miniconda/ 2>/dev/null | grep -o 'Miniconda3-py38_[^"]*-Linux-x86_64.sh' | head -n 1) > /tmp/miniconda.sh \
&& chmod +x /tmp/miniconda.sh \
&& /tmp/miniconda.sh -b -p /opt/conda

ENV PATH=/opt/conda/bin:$PATH
RUN conda init


# Now, proceed with the installation of Mojo
RUN curl https://get.modular.com | sh - && \
modular auth AUTHKEY
RUN modular install mojo

ARG MODULAR_HOME="/root/.modular"
ENV MODULAR_HOME=$MODULAR_HOME
ENV PATH="$PATH:$MODULAR_HOME/pkg/packages.modular.com_mojo/bin"

# Change permissions to allow for Apptainer/Singularity containers
RUN chmod -R a+rwX /root

# Set the default command to run the Mojo program
CMD ["mojo", "main.🔥"]
# Use Ubuntu 20.04 as the base image
FROM ubuntu:20.04

ARG DEFAULT_TZ=America/Los_Angeles
ENV DEFAULT_TZ=$DEFAULT_TZ

RUN apt-get update \
&& DEBIAN_FRONTEND=noninteractive TZ=$DEFAULT_TZ apt-get install -y \
tzdata \
vim \
nano \
sudo \
curl \
wget \
git && \
rm -rf /var/lib/apt/lists/*

# Download the latest version of minicoda py3.8 for linux x86/x64.
RUN curl -fsSL https://repo.anaconda.com/miniconda/$( wget -O - https://repo.anaconda.com/miniconda/ 2>/dev/null | grep -o 'Miniconda3-py38_[^"]*-Linux-x86_64.sh' | head -n 1) > /tmp/miniconda.sh \
&& chmod +x /tmp/miniconda.sh \
&& /tmp/miniconda.sh -b -p /opt/conda

ENV PATH=/opt/conda/bin:$PATH
RUN conda init


# Now, proceed with the installation of Mojo
RUN curl https://get.modular.com | sh - && \
modular auth AUTHKEY
RUN modular install mojo

ARG MODULAR_HOME="/root/.modular"
ENV MODULAR_HOME=$MODULAR_HOME
ENV PATH="$PATH:$MODULAR_HOME/pkg/packages.modular.com_mojo/bin"

# Change permissions to allow for Apptainer/Singularity containers
RUN chmod -R a+rwX /root

# Set the default command to run the Mojo program
CMD ["mojo", "main.🔥"]
And building the container with this docker build --tag ark-guardian . docker run --env-file .env -p 8080:8080 ark-guardian I am running this from apple silicon though, could that be why? I thought now that it worked for apple silicon it should work in a docker container too Oh yep looks like that was the error, seems like mojo on ubuntu docker container is not friendly to apple silicon
Alex Kirchhoff
Alex Kirchhoff•14mo ago
Please consider editing your message to remove your Modular auth key -- these can be used to impersonate you.
Logan
LoganOP•14mo ago
Oh I thought I removed that, thanks. Good catch
Want results from more Discord servers?
Add your server