user232343
user232343

Reputation: 2118

docker with postgres and bash

Today I was researching and trying docker, and with the most of things I was impressed. There are still some questions for me about docker.

Can anyone more experienced than me with Docker tell me what is the best way to login to postgres container (run bash), in order to view some postgres configuration files, view postgres logs, log into postgres shell, execute pg_dump for example, etc. etc..., and everything this while postgres process is running.

I see that people usually run one process per container, and with this approach I am not sure what is the best way to do mentioned actions on container which runs postgres?

Any advices?

Thanks!

Upvotes: 1

Views: 246

Answers (2)

Mykola Gurov
Mykola Gurov

Reputation: 8695

The canonical docker way would be not to log in to the running db container, but instead do docker logs or link other containers to do maintenance tasks (e.g. docker run -it --rm --link <my-pg-container>:pg <my-pg-image> pgsql --host pg etc..

Upvotes: 1

Andr&#233; Laszlo
Andr&#233; Laszlo

Reputation: 15537

You can usually get a shell like this:

docker exec -it some-node bash

Upvotes: 3

Related Questions