From 0a950a4c23d72c69fe66b921b08212fbfc0254cd Mon Sep 17 00:00:00 2001 From: Issy Long Date: Tue, 1 Nov 2022 22:55:42 +0000 Subject: [PATCH] .devcontainer/on-create-command: Add `openssh-server` (for `gh cs ssh`) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - My Codespaces workflow sometimes involves `gh cs ssh` for a terminal and tmux and vim (for better or for worse). - I tried this on a `Homebrew/brew` Codespace and got this error. But it felt weird following that instruction to the letter and bloating the Docker image which we by default keep minimal. ``` ❯ gh cs ssh ? Choose codespace: Homebrew/brew (master): redesigned spork error getting ssh server details: failed to start server: Please check if an SSH server is installed in the container. If the docker image being used for the codespace does not have an SSH server, install it in your Dockerfile or, for codespaces that use Debian-based images, you can add the following to your devcontainer.json: "features": { "ghcr.io/devcontainers/features/sshd:1": { "version": "latest" } } ``` --- .devcontainer/on-create-command.sh | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.devcontainer/on-create-command.sh b/.devcontainer/on-create-command.sh index c738336b33..614759bbca 100755 --- a/.devcontainer/on-create-command.sh +++ b/.devcontainer/on-create-command.sh @@ -18,5 +18,9 @@ sudo apt-get update sudo apt-get install -y \ -o Dpkg::Options::=--force-confdef \ -o Dpkg::Options::=--force-confnew \ + openssh-server \ zsh \ zsh-autosuggestions + +# Start the SSH server so that `gh cs ssh` works. +sudo service ssh start