Skip to content

Commit

Permalink
Added SSH to devenv on port 2222 (#124)
Browse files Browse the repository at this point in the history
  • Loading branch information
ClemensElflein authored Jul 23, 2024
1 parent 8282825 commit 10d7318
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 5 deletions.
16 changes: 14 additions & 2 deletions devenv/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,20 @@ ARG MY_USER
RUN groupadd -g ${MY_GID} -o ${MY_USER}

# Create a new user, assign it to the group, and set its shell to bash
RUN useradd -m -u ${MY_UID} -g ${MY_GID} -o -s /bin/bash ${MY_USER}
RUN useradd -m -u ${MY_UID} -g ${MY_GID} -o -s /bin/bash ${MY_USER} && yes ${MY_USER} | passwd ${MY_USER}

RUN apt-get update && apt-get install -y zsh git
RUN apt-get update && apt-get install -y zsh git sudo ssh gdb rsync
RUN echo "$MY_USER ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers

RUN ( \
echo 'LogLevel DEBUG2'; \
echo 'PermitRootLogin yes'; \
echo 'PasswordAuthentication yes'; \
echo 'ListenAddress 0.0.0.0:2222'; \
echo 'Subsystem sftp /usr/lib/openssh/sftp-server'; \
) > /etc/ssh/sshd_clion \
&& mkdir /run/sshd
RUN bash -c "ssh-keygen -A"

# Update rosdep package manager for ROS
RUN rosdep update --rosdistro $ROS_DISTRO
Expand All @@ -36,3 +47,4 @@ RUN apt-get update && \
rm -rf /var/lib/apt/lists/*


CMD ["sudo", "/usr/sbin/sshd", "-D", "-e", "-f", "/etc/ssh/sshd_clion"]
4 changes: 1 addition & 3 deletions devenv/docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ services:
- MY_UID=${MY_UID:-1000}
- MY_GID=${MY_GID:-1000}
- MY_USER=${MY_USER:-dev}
# this will block forever and keep the container running
command: tail -F /dev/null
environment:
- DISPLAY=${DISPLAY}
- QT_X11_NO_MITSHM=1
Expand All @@ -17,4 +15,4 @@ services:
- /tmp/.X11-unix:/tmp/.X11-unix:rw
- ../:/workspace:rw
user: "${MY_UID:-1000}:${MY_GID:-1000}"

network_mode: "host"

0 comments on commit 10d7318

Please sign in to comment.