title: How to recreate Docker container?
body: <p>I'm new to docker and I'm using docker compose. For some reason my postgres container is now broken</p>
  
  <p>I'm trying this command <code>docker-compose up --no-deps --build db</code></p>
  
  <p>And it's returning me this:</p>
  
  <pre><code>MacBook-Pro-de-Javier:goxo.api javier$ docker-compose up --no-deps --build db
  Recreating testapi_db_1
  Attaching to testapi_db_1
  db_1   | LOG:  database system was shut down at 2017-04-20 17:19:05 UTC
  db_1   | LOG:  MultiXact member wraparound protections are now enabled
  db_1   | LOG:  database system is ready to accept connections
  db_1   | LOG:  autovacuum launcher started
  </code></pre>
  
  <p>Whenever I try to connect (with the same connection arguemnts than before) I get this:</p>
  
  <pre><code>^[[Adb_1   | FATAL:  database "test" does not exist
  </code></pre>
  
  <p>This is part of my docker-compose.yml</p>
  
  <pre><code>version: "3"
  services:
    db:
      image: postgres
      ports:
        - "3700:5432"
      environment:
        POSTGRES_HOST: "127.0.0.1"
        POSTGRES_DB: "test"
        POSTGRES_USER: "postgres"
        POSTGRES_PASSWORD: "postgres1"
      tmpfs:
        - /tmp
        - /var/run/postgresql
      volumes:
        - db:/var/lib/postgresql/data
        - ./config/postgres-initdb.sh:/docker-entrypoint-initdb.d/initdb.sh
  </code></pre>
  
  <p>Any ideas on how can I recreate the docker image to be how it was before? It was working as it was created the first time</p>
  
  <p>Thanks</p>
  
  <p><strong>EDIT 1:</strong> If I run <code>docker-compose build &amp;&amp; docker-compose up</code></p>
  
  <p>Terminal throws this:</p>
  
  <pre><code>db uses an image, skipping
  </code></pre>
  
  <p><strong>EDIT 2:</strong> This command does not create database again neither:</p>
  
  <pre><code>docker-compose up --force-recreate --abort-on-container-exit --build db
  </code></pre>