title: Opening a shell into a Java image
body: <p>I'm building a postgres+java container, and I'd like to open a shell into the java "service". That service exits immediately after starting, how can I do to open a shell into it?</p>
  
  <p>I see it in <code>docker ps -a</code> but it has already exited.</p>
  
  <p>The file I'm using is this .yaml with docker-compose</p>
  
  <pre><code>version: '3.1'
  
  services:
  
    db:
      image: postgres
      restart: always
      environment:
        POSTGRES_PASSWORD: postgres
      volumes:
  
        - datavolume:/var/lib/postgresql
  
  
    java:
  
      image: openjdk:8
  
  volumes:
  
    datavolume:
  </code></pre>