# Dockerizing Postgres

```
docker run --name postgres -e POSTGRES_PASSWORD=YOURSECRETPASS -d -v /your/db/path:/var/lib/postgresql/data postgres
```

then link other containers with this one


using systemd:
```
[Unit]
Description=Postgres container
Requires=docker.service
After=docker.service

[Service]
Restart=always
ExecStart=/usr/bin/docker start -a postgres
ExecStop=/usr/bin/docker stop -t 2 postgres

[Install]
WantedBy=local.target
```