title: dockerized postgres and dockerized Spring boot app
body: <p>my application.properties file</p>
  
  <pre><code>server.port=8085
  spring.datasource.driverClassName=org.postgresql.Driver
  spring.datasource.url=jdbc:postgresql://init-postgres:5432/dbname
  spring.datasource.username=username
  spring.datasource.password=password
  
  spring.jpa.database-platform=org.hibernate.dialect.PostgreSQLDialect
  spring.jpa.generate-ddl=true
  spring.jpa.show-sql=true
  spring.jpa.hibernate.ddl-auto=update
  </code></pre>
  
  <p>and for dockerizing postgres I'm using command</p>
  
  <pre><code>docker run -d -p 5432:5432 --name init-postgres -e POSTGRES_DB=dbname -e POSTGRES_USER=username -e POSTGRES_PASSWORD=password postgres
  </code></pre>
  
  <p>but it gives <strong>java.net.UnknownHostException: init-postgres</strong>
  I'm beginner with Docker and learning it from a tutorial. to dockerized Postgresql &amp; Spring boot app communication.</p>