ARG ROS_DISTRO=galactic FROM ros:${ROS_DISTRO}-ros-base-focal ARG ROS_DISTRO=galactic ARG USERNAME=jasper ARG USER_UID=1000 ARG USER_GID=$USER_UID # Create the user RUN groupadd --gid $USER_GID $USERNAME \ && useradd --uid $USER_UID --gid $USER_GID -m $USERNAME \ # # [Optional] Add sudo support. Omit if you don't need to install software after connecting. && sed -i 's/http:\/\/archive.ubuntu.com\//http:\/\/mirrors.aliyun.com\//g' /etc/apt/sources.list \ && apt-get update \ && apt-get install -y sudo \ && echo $USERNAME ALL=\(root\) NOPASSWD:ALL > /etc/sudoers.d/$USERNAME \ && chmod 0440 /etc/sudoers.d/$USERNAME \ && apt-get update && apt-get upgrade -y \ && apt-get install -y python3-pip ENV SHELL /bin/bash # ******************************************************** # * Anything else you want to do like clean up goes here * # ******************************************************** RUN echo 'source /opt/ros/galactic/setup.bash' >> /home/jasper/.bashrc \ && echo 'cd ~/Work/Robot' >> /home/jasper/.bashrc # [Optional] Set the default user. Omit if you want to keep the default as root. USER $USERNAME CMD ["/bin/bash"]