I'm creating a Docker container for development (I've done it before and never had this problem) but when the Dockerfile executes the command ''RUN apt-get install -y sudo" the execution fails with the following result:
#0 0.563 Reading package lists...
#0 0.594 Building dependency tree...
#0 0.602 Reading state information...
#0 0.607 Package sudo is not available, but is referred to by another package.
#0 0.607 This may mean that the package is missing, has been obsoleted, or
#0 0.607 is only available from another source
#0 0.607
#0 0.609 E: Package 'sudo' has no installation candidate
The following is the dockerfile I'm trying to run:
FROM node:18-bullseye
# Arguments
ARG USER=platzi
ARG USER_HOME=/home/$USER
ARG VOLUME=/home/volume
ARG SHELL=/bin/bash
RUN apt-get update
# Install OS utilities
RUN apt-get install -y locales \
&& sed -i 's/^# *\(en_US.UTF-8\)/\1/' /etc/locale.gen \
&& locale-gen
RUN apt-get install -y sudo **execution fails here**
RUN apt-get install -y python3-pip
RUN pip3 install --upgrade pip
# Install Dev utilities
RUN pip3 install yapf
RUN pip3 install jupyter
# Install CLI utilities
RUN apt-get install -y jq
RUN curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip" \
&& unzip awscliv2.zip \
&& ./aws/install \
&& apt-get install -y less
# Set up non root user
RUN echo "$USER ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers
RUN useradd -ms $SHELL $USER
RUN mkdir -p $VOLUME \
&& chown -R $USER:$USER $VOLUME
# Preserve bash history
RUN SNIPPET="export PROMPT_COMMAND='history -a' && export HISTFILE=/commandhistory/.bash_history" \
&& echo $SNIPPET >> "/root/.bashrc" \
&& mkdir /commandhistory \
&& touch /commandhistory/.bash_history \
&& chown -R $USER /commandhistory \
&& echo $SNIPPET >> "$USER_HOME/.bashrc"
USER $USER