The latest release of Docker doesn't use a virtual machine anymore, instead using a hypervisor to connect to the containers. This means I can no longer login to postgres with psql
:
➜ postgres git:(master) ✗ docker run -d -p 5433:5432 db postgres
<sha>
➜ postgres git:(master) ✗ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
111f3bed4c52 db "/docker-entrypoint.s" 17 minutes ago Up 17 minutes 0.0.0.0:5433->5432/tcp zen_hugle
➜ postgres git:(master) ✗ psql -p 5433 -U postgres
psql: could not connect to server: No such file or directory
Is the server running locally and accepting
connections on Unix domain socket "/tmp/.s.PGSQL.5433"?
I have also tried specifying localhost as the host, but that results in a strange output:
➜ postgres git:(master) ✗ psql -h localhost -p 5433 -U postgres
psql: %
Does anyone know what to do in this case? Thank you.
-h localhost
to thepsql
command?