title: How to get an interactive bash shell in a Docker container
body: <p>I'm trying to connect to a running container or start a new container in interactive mode with the bash shell -- not the sh shell. I want to run:</p>
  
  <pre><code>docker exec -it &lt;container_name&gt; /bin/bash
  </code></pre>
  
  <p>or</p>
  
  <pre><code>docker run -it &lt;container_name&gt; &lt;image_name&gt;
  </code></pre>
  
  <p>or</p>
  
  <pre><code>docker run -it &lt;container_name&gt; &lt;image_name&gt; /bin/bash
  </code></pre>
  
  <p>and get an interactive bash shell.</p>
  
  <h2>What I've tried so far:</h2>
  
  <p>Per <a href="https://github.com/moby/moby/issues/7281#issuecomment-389440503" rel="nofollow noreferrer">this post</a> I've tried</p>
  
  <h3>Adding this to my Dockerfile</h3>
  
  <pre><code>SHELL ["/bin/bash", "-c"]
  </code></pre>
  
  <h3>Adding this to my Dockerfile</h3>
  
  <pre><code>RUN ["/bin/bash", "-c", "echo I am now using bash!"]
  </code></pre>
  
  <p>But every time I try to run a container in interactive mode (<code>docker run -it</code> or attach to a running container (<code>docker exec -it</code>), I land in the <code>sh</code> shell.</p>
  
  <p>How can I get an interactive bash shell that is running inside a docker container?</p>
  
  <h3>Update: Minimal working Dockerfile</h3>
  
  <pre><code>FROM ubuntu
  
  SHELL ["/bin/bash", "-c"]
  </code></pre>