title: why do i need tty: true in docker-compose.yml and other images do not?
body: <p>I've been looking for the answer for a while, but I haven't found it and I need to understand before I go ahead with my tests.</p>
  <p>I am creating an image based on Alpine by installing bash as in the following image:</p>
  <pre><code>FROM alpine:3.12
  
  RUN apk add --no-cache --upgrade bash rsync gzip \
  &amp;&amp; rm -rf /var/cache/apk/*
  
  COPY ./docker/backup/hello.sh /hello.sh
  
  RUN mkdir /backup \
  &amp;&amp; chmod u+x /hello.sh
  
  WORKDIR /backup
  
  ENTRYPOINT [&quot;sh&quot;,&quot;/hello.sh&quot;]
  CMD [&quot;/bin/bash&quot;]
  </code></pre>
  <p>hello.sh</p>
  <pre><code>#!/bin/sh
  echo &quot;=&gt; Hello Word&quot;
  echo &quot;$@&quot;
  exec &quot;$@&quot;
  </code></pre>
  <p>The first time I tried bash I could not access with the following command:</p>
  <pre><code>docker-compose exec myalpine bash
  </code></pre>
  <p>But searching if I found the answer, I had to put in my docker-compose.yml <code>tty: true</code>, and I already was able to access the <code>myalpine</code> container shell after launching the command <code>docker-compose up -d</code></p>
  <p>Resulting in a part of my docker-compose.yml as follows</p>
  <pre><code>services:
    myalpine:
      build:
        context: ./
        dockerfile: ./docker/backup/Dockerfile
        args:
          - DOCKER_ENV=${DOCKER_ENV}
      restart: unless-stopped
      tty: true
      container_name: ${PROJECT_NAME}-files
      volumes:
        - appdata:/app
        - ./data/app/backup:/backup
    mysql:
      build:
        context: ./
        dockerfile: ./docker/mysql/Dockerfile
        args:
          - MYSQL_VERSION=${MYSQL_VERSION}
          - DOCKER_ENV=${DOCKER_ENV}
      restart: always
      container_name: ${PROJECT_NAME}-mysql
      environment:
        MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD}
        MYSQL_DATABASE: ${MYSQL_DATABASE}
        MYSQL_USER: ${MYSQL_USER}
        MYSQL_PASSWORD: ${MYSQL_PASSWORD}
      volumes:
        - dbdata:/var/lib/mysql
      networks:
        - db
  </code></pre>
  <p>And now my question is why in other services of my docker-compose like <code>mysql</code>, I can access the bash without adding <code>tty:true</code>?</p>
  <p>Example:</p>
  <pre><code>docker-compose exec mysql bash
  </code></pre>
  <p>I can access without having added <code>tty:true</code> to the docker-compose.yml, so there must be something in Alpine's image that I don't understand and would like to understand.</p>