如何使用官方的 Apache AGE Docker 镜像?

huangapple go评论108阅读模式
英文:

How to use the official Apache AGE docker image?

问题

我已按照官方文档的步骤来运行容器,使用以下命令:

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

但它就停在那里了。

我该如何登录到psql?我应该登录哪个用户?应该使用什么命令?

我进入了容器控制台,看到已经有一个用户'postgres'和一个运行中的服务器,但无法使用常规命令如psql postgresUser进入psql。

有人知道如何在官方Apache AGE Docker容器中登录psql吗?

英文:

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?

答案1

得分: 2

如果您想登录到官方的Apache AGE Docker容器中的psql,您可以使用以下命令:

psql -h localhost -p 5455 -U postgres
英文:

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

答案2

得分: 1

要登录到 Apache AGE Docker 容器上的 psql,运行以下命令:

docker exec -it age bash

这将连接并访问正在运行的 Docker 容器的 shell。

而以下命令将访问 PostgreSQL 数据库:

psql -d postgresDB -U postgresUser
英文:

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.

答案3

得分: 0

连接终端到Docker终端,如果容器尚未运行,可以使用 docker exec,如果容器正在运行,则可以使用 docker attach

docker exec -it <容器ID> bash

这将连接终端到正在运行的Docker容器,并且从这里,您可以将其用作容器中的终端。

要启动psql,请使用以下命令。

psql -d postgresDB -U postgresUser
英文:

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 &lt;container ID&gt; 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

答案4

得分: -1

要获取官方的 Apache AGE Docker 容器,请运行以下命令:

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

您可以根据需要使用相应的端口号。端口 5432 用于连接到 Apache AGE 数据库,端口 5455 用于访问 Apache AGE 的 Web 界面。

英文:

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.

答案5

得分: -1

docker exec -it age psql -U postgres

您可以使用此命令直接在 Docker 中执行操作。

英文:
docker exec -it age psql -U postgres

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

答案6

得分: -2

我也遇到了同样的问题,下面是我用来登录到 Apache Age Docker 容器的命令:

docker exec -it age psql -U postgres
英文:

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

答案7

得分: -2

要登录官方的Apache AGE Docker容器并访问psql,您有几种选项。使用以下PSQL命令:psql -h localhost -p 5455 -U postgres或者您可以使用Docker Exec,如下所示:docker exec -it age psql -U postgres,这将直接连接到容器内的PostgreSQL服务器,使用"postgres"用户。但要小心使用"postgres"用户,因为通常它是访问AGE Docker容器的默认用户。

英文:

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.

答案8

得分: -2

检查容器的状态:

docker logs age

访问 PostgreSQL:
要使用以下命令访问 PostgreSQL 实例,请使用 psql 命令:

psql -h localhost -p 5455 -U postgres postgresDB

当您运行 psql 命令时,您可能需要输入 postgres 用户的密码。在您的 docker run 命令中输入该密码。

请记住在主机上执行 psql 命令,而不是在容器内部执行。如果您想直接在容器内部执行 SQL 命令,可以使用以下命令访问容器的 shell:

docker exec -it age bash

然后在容器内部,您可以使用 psql 命令与 PostgreSQL 实例交互。

希望这能解决问题!

英文:

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!

答案9

得分: -3

使用以下命令连接到运行在容器内部的PostgreSQL实例,在您的主机上使用psql命令行工具:

docker exec -it age psql -U postgres

使用"postgres"用户,此命令将连接您到PostgreSQL服务器并启动psql shell。希望这对您有用。

英文:

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.

答案10

得分: -3

docker exec -it age psql -U postgres
使用此命令连接到 postgresSQL

英文:
 docker exec -it age psql -U postgres

Use this command to connect postgresSQL

答案11

得分: -3

psql -h localhost -p 5455 -U postgres

英文:

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

答案12

得分: -3

要访问Apache AGE Docker容器,请使用以下命令:

psql -h localhost -p 5455 -U postgres

或者可以使用以下命令直接通过Docker执行:

docker exec -it age psql -U postgres
英文:

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

答案13

得分: -4

以下是您用于登录到Apache Age Docker容器的简化命令版本:<br>docker exec -it age psql -U postgres

英文:

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

huangapple
  • 本文由 发表于 2023年8月10日 22:16:16
  • 转载请务必保留本文链接:https://go.coder-hub.com/76876584.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定