Here's a link to a LinkedIn Learning course called "Learning Linux Command Line"
https://www.linkedin.com/learning/learning-linux-command-line-14447912/
You can access the course via the ABQ Library website:
https://abqlibrary.org/az/linkedin-learning-formerly-lyndacom
Here's a Dockerfile to build an image. Save the commands below into a file called Dockerfile.
# Use the official Ubuntu base image
FROM ubuntu:latest
# Specify the shell to be used for RUN commands
SHELL ["/bin/bash", "-c"]
# Prevent interactive prompts during package installation
ARG DEBIAN_FRONTEND=noninteractive
# Unminimize
RUN yes | unminimize
# Update the package list and install sudo
RUN apt-get update && \
apt-get install -y \
git \
jq \
less \
man-db \
nano \
sudo \
tree \
vim \
zip \
unzip \
;
# Rename existing Ubuntu user
ARG USERNAME=scott
RUN usermod -l ${USERNAME} ubuntu && \
usermod -d /home/${USERNAME} -m ${USERNAME} && \
usermod -c ${USERNAME^} ${USERNAME} && \
groupmod -n ${USERNAME} ubuntu
# Set a password for the new user (change 'password' to a secure password)
RUN echo "${USERNAME}:password" | chpasswd
# Give warning once
RUN echo -e 'Defaults lecture=once\n\n' >> /etc/sudoers
# Switch to the new user
USER ${USERNAME}
# Set the working directory to the user's home
WORKDIR /home/${USERNAME}
# Set default umask
RUN echo 'umask 002' >> ./.bashrc
# Create README.md file in user's home
RUN cat <<'EOF' > README.md
## Clone git repo from LinkedIn Learning
git clone https://github.com/LinkedInLearning/learning-linux-command-line-3005201.git Documents
EOF
# Make some folders
RUN mkdir -p Desktop Downloads
# Start an interactive bash shell by default
CMD ["/bin/bash"]
# Copy Dockerfile into image
COPY Dockerfile /
In the same folder where the file Dockerfile is located, run this command.
docker image build -t ubuntu-sudo-user .
docker container run --rm -d --name learn_linux ubuntu-sudo-user sleep inf
docker container exec -i learn_linux /bin/bash README.md
docker container exec -it learn_linux /bin/bash
docker container stop learn_linux ubuntu-sudo-user