title: Official docker image for mariadb -- how to add ssh service
body: <p>I am new to docker, and have been playing with the docker image in <code>hub.docker.com</code></p>
  
  <p>I want to add ssh service to the container.  I could <code>apt-get install</code> the package (after <code>apt-get update</code>), but I don't know how to start it.
  Normally (not in this container), we could start the service via a regular command of <code>service ssh start</code>.  But I don't know how to do this in the container without out interfering with the <code>ENTRYPOINT</code> and <code>CMD</code> mechanisms.</p>
  
  <p>The dockerfile comes with a <code>docker-entrypoint.sh</code> (see source code <a href="https://github.com/docker-library/mariadb/blob/8bbe483d5fc132b87063db9d22132b571a778fd4/10.3/docker-entrypoint.sh" rel="nofollow noreferrer">here</a>) that pretty much expects to have a line for <code>CMD</code></p>
  
  <pre><code>CMD ["mysqld"]
  </code></pre>
  
  <p>I have read some related SO articles, such as these:</p>
  
  <ul>
  <li><a href="https://stackoverflow.com/questions/25135897/how-to-automatically-start-a-service-when-running-a-docker-container/32179054#32179054">How to automatically start a service when running a docker container?</a></li>
  <li><a href="https://stackoverflow.com/questions/22886470/start-sshd-automatically-with-docker-container">Start sshd automatically with docker container</a></li>
  </ul>
  
  <p>but they are not directly applicable here due to the interplay of <code>ENTRYPOINT</code> and <code>CMD</code> in the docker file.</p>