-1

I have followed the official documentation in order to run the container, using

docker pull apache/age

docker run \
    --name age  \
    -p 5455:5432 \
    -e POSTGRES_USER=postgresUser \
    -e POSTGRES_PASSWORD=postgresPW \
    -e POSTGRES_DB=postgresDB \
    -d \
    apache/age

but it stops there.

How can I log in to psql? Which user should I log in to? What are the commands to use?

I entered inside the container console and saw there's already a user 'postgres' and a server running, but couldn't enter psql with common commands like psql postgresUser.

Does anyone know how to login to psql on the official Apache AGE docker container?

Marco Souza
  • 296
  • 7

13 Answers13

2

If you want to to login to psql on the official Apache AGE docker container, you can use the following command:

psql -h localhost -p 5455 -U postgres
adil shahid
  • 125
  • 4
1

To login to psql on Apache AGE docker container, run:

docker exec -it age bash

This connects and access the shell of the running docker container.

psql -d postgresDB -U postgresUser

while this accesses the PostgreSQL database.

Tito
  • 289
  • 8
0

To connect the terminal to the docker terminal, you can use either docker exec if the container is not already running or docker attach if the container is running.

docker exec -it <container ID> bash

This will attach the terminal to the running docker container, and from here, you can use it as a terminal in the container.

To start psql use this command.

psql -d postgresDB -U postgresUser
abhishek2046
  • 312
  • 1
  • 11
-1

To get an official Apache AGE docker container, run the below command

psql -h localhost -p 5432/5455 -U postgres

You can use the port number as required to you. Port 5432 is used for connecting to the Apache AGE database and port 5455 is used for accessing the Apache AGE web interface.

-1
docker exec -it age psql -U postgres

You can use this command to directly execute the operation using docker

-2

I also came accross the same problem, the below command I used to login to psql to apache age docker docker container.

docker exec -it age psql -U postgres
Aadil Bashir
  • 111
  • 5
-2

To log in to the official Apache AGE Docker container and access psql, you have a few options. Using the PSQL command as follows psql -h localhost -p 5455 -U postgres or you can use the Docker Exec as follows docker exec -it age psql -U postgres that connects your directly to the PostgreSQL server within the container using the "postgres" user. Be careful to use the "postgres" user though since it is usually the default user for accessing the AGE Docker container.

Hassoo
  • 85
  • 11
-2

Check container's status:

docker logs age

Access PostgreSQL: To access the PostgreSQL instance using psql use the following command

psql -h localhost -p 5455 -U postgres postgresDB

When you run the psql command, you might need to enter the password for the postgres user. Enter that password in your docker run command.

Remember to execute the psql command on your host machine and not a inside the container. If you want to execute SQL commands directly inside the container, you can access the container's shell using:

docker exec -it age bash

and then within the container, you can use the psql command to interact with the PostgreSQL instance

Hope this will resolve the issue!

-3

To connect to the PostgreSQL instance running inside the container, use the psql command-line tool on your host machine. To connect, use the following command:

    docker exec -it age psql -U postgres

Using the "postgres" user, this command will connect you to the PostgreSQL server and launch the psql shell.

Hope this is useful.

Raja Rakshak
  • 168
  • 2
-3
 docker exec -it age psql -U postgres

Use this command to connect postgresSQL

-3

It seems you are having issue while login to psql on the official Apache AGE docker container, You can try and use the following command to check your problem can be resolved or not.

psql -h localhost -p 5455 -U postgres
-3

To access an Apache AGE docker container, use the following command:

psql -h localhost -p 5455 -U postgres

Or use this to directly execute using docker

docker exec -it age psql -U postgres
Saif Ali
  • 53
  • 3
-4

Here's a simpler version of the command you used to log in to the Apache Age Docker container:
docker exec -it age psql -U postgres

Zeeshan
  • 3
  • 1