Postgres
Subir novo banco
$ sudo docker run –name postgres -p 5432:5432 -e POSTGRES_PASSWORD=postgres -d postgres
OBS: Caso apresente a seguinte mensagem:
docker: Error response from daemon: Conflict. The container name “/postgres” is already in use by container
Execute o comando para listar os containers
$ sudo docker container ls -a
Possível retorno (caso algum container tenha sido executado):
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
d1eeef8cb196 postgres "docker-entrypoint.s…" 8 minutes ago Exited (1) 8 minutes ago strange_driscoll
a15a476e5762 postgres:latest "docker-entrypoint.s…" 15 minutes ago Exited (1) 15 minutes ago upbeat_almeida
6e848c2aa472 postgres "docker-entrypoint.s…" 2 months ago Exited (0) 2 months ago postgres
6384a84eb8a0 postgres:14-alpine "docker-entrypoint.s…" 3 months ago Exited (0) 8 weeks ago my-postgres
d4033c9b13ae mysql "docker-entrypoint.s…" 3 months ago Exited (0) 8 weeks ago mysql
Reiniciar o container pelo nome
$ sudo docker restart my-postgres