title: Unable to SSH into Docker container running Alpine Linux 3.10
body: <p>I am having problems using SSH to connect into a Docker container (from <a href="https://hub.docker.com/layers/timescale/timescaledb/latest-pg11-bitnami/images/sha256-d518d9110140922867344813d28a52eaa1ca25d7ef15cfe8f3d677d619d4ff7a?context=explore" rel="nofollow noreferrer">this image</a>) running Alpine Linux 3.10. </p>
  
  <p>SSH must be used for this connection, as I am using a backup software <code>barman</code> which requires an SSH connection to the PostgreSQL 11 database running inside the Docker container.</p>
  
  <p>First I connected into the docker container using</p>
  
  <pre><code>docker exec -it &lt;container_name&gt; /bin/bash
  </code></pre>
  
  <p>then tried to reinstall and start <code>sshd</code></p>
  
  <pre><code>bash-5.0# apk add openssh --no-cache
  fetch http://dl-cdn.alpinelinux.org/alpine/v3.10/main/x86_64/APKINDEX.tar.gz
  fetch http://dl-cdn.alpinelinux.org/alpine/v3.10/community/x86_64/APKINDEX.tar.gz
  OK: 117 MiB in 42 packages
  
  bash-5.0# apk add openrc --no-cache
  fetch http://dl-cdn.alpinelinux.org/alpine/v3.10/main/x86_64/APKINDEX.tar.gz
  fetch http://dl-cdn.alpinelinux.org/alpine/v3.10/community/x86_64/APKINDEX.tar.gz
  OK: 117 MiB in 42 packages
  
  bash-5.0# rc-update add sshd
   * rc-update: sshd already installed in runlevel `sysinit'; skipping
  
  bash-5.0# /etc/init.d/sshd start
   * WARNING: sshd is already starting
  </code></pre>
  
  <p>However, I am unable to connect to the local <code>sshd</code> server from inside the Docker container</p>
  
  <pre><code># ssh root@127.0.0.1
  ssh: connect to host 127.0.0.1 port 22: Connection refused
  </code></pre>
  
  <p>Similarly, connecting into the Docker container via SSH from the Ubuntu host machine fails as well.</p>
  
  <pre><code>$ ssh postgres@172.26.0.4
  ssh: connect to host 172.26.0.4 port 22: Connection refused
  </code></pre>
  
  <p>where 172.26.0.4 is the IP address shown from running <code>ifconfig</code> inside the Docker container.</p>
  
  <p>Any ideas how we can solve this?</p>