dockerrun--namemy-postgres-container-d-p5432:5432 my-postgres-image 1. 代码解释: docker run: 用于创建并运行容器。 –name my-postgres-container: 给容器指定名称。 -d: 让容器在后台运行。 -p 5432:5432: 映射主机的 5432 端口到容器的 5432 端口。 my-postgres-image: 指定要运行的镜像名称。 5. ...
首先要拉取 pq的image: docker pull postgres, 拉取后可以用docker image ls查看是否拉取镜像成功。 同理,一同拉取pgadmin4方便查看数据: docker pull dpage/pgadmin4。 然后运行image,生成container,运行pq和pgadmin: 注意,因为数据库需要存储空间,配合docker运行就需要volume,注意下方两种volume创建方式: docker run...
https://github.com/docker-library/postgres Maintained by:the PostgreSQL Docker Community This is the Git repo of theDocker "Official Image"forpostgres(not to be confused with any officialpostgresimage provided bypostgresupstream). Seethe Docker Hub pagefor the full readme on how to use this Dock...
https://github.com/docker-library/postgres Maintained by: the PostgreSQL Docker Community This is the Git repo of the Docker "Official Image" for postgres (not to be confused with any official postgres image provided by postgres upstream). See the Docker Hub page for the full readme on how...
创建一个Docker Compose文件(例如docker-compose.yml),并在其中定义一个服务来运行Postgres容器。示例配置如下: 代码语言:yaml 复制 version:'3'services:postgres:image:postgresports:-5432:5432environment:-POSTGRES_USER=your_username-POSTGRES_PASSWORD=your_password-POSTGRES_DB=your_database ...
dockerrun--namemy-postgres-container-d-p5432:5432 my-postgres-image 1. 注释: --name my-postgres-container:为容器指定一个名称。 -d:表示以分离模式运行容器。 -p 5432:5432:将主机的 5432 端口映射到容器的 5432 端口。 一旦容器启动后,可以通过以下命令检查容器是否正在运行: ...
[root@128 postgres]# docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES d1719ff15b21 postgres:latest "docker-entrypoint.s…" 6 minutes ago Up 6 minutes 0.0.0.0:5432->5432/tcp, :::5432->5432/tcp postgres b4e746e59cfc mysql:8.0 "docker-entrypoint.s…" 17 hours ago Up 17 ho...
# 不指定具体版本的话,默认下载最新版镜像postgres:latest docker pull postgres 镜像拉取成功后,可以通过docker image ls命令查看到存在名为postgres的镜像 从镜像运行容器 docker run --name postgres -e POSTGRES_PASSWORD=Abc1234% -p 5432:5432 -v /home/zx/postgres/data:/var/lib/postgresql/data -d postg...
【步骤二】 浏览dockerhub(https://hub.docker.com) 寻找我们需要的 image 由于我是要安装 postgres ,因此我就在 dockerhub 中搜索它,很快我们就找到了 postgres 的官方镜像: Postgres 的 dockerhub 官方主页:https://hub.docker.com/_/postgres 【步骤三】 在操作系统上创建挂载点 ...