# Database creation with Docker

We will use [Docker](https://www.docker.com/) to have a container for a Postgres database. Create, at the root of the project, the file <mark style="color:purple;">docker-compose.yml</mark> with following content:

```yaml
services:
  database:
    image: postgres
    restart: always
    ports:
      - 5432:5432
    environment:
      POSTGRES_PASSWORD: pass123      
    volumes:
      - database_data:/var/lib/postgresql/data

volumes:
  database_data:
```

{% hint style="info" %}
We are writing our database password in plain text. This is a security issue. In the **Configuration** section, we'll learn how to fix this.
{% endhint %}

To turn on the container, use the following command:

```sh
docker-compose up -d
```

If you want to turn it off at some point, just use:

```sh
docker-compose down
```

Finally, to access our database, we can use [pgAdmin](https://www.pgadmin.org/). We shall register a server with the following settings:

* **Name** - Conrod
* **Host name/address** - localhost
* **Port** - 5432
* **Password** - pass123
* **Save password?** - Yes

<mark style="color:green;">**Commit**</mark> - Creating database
