2024-03-01 06:39PM
安装docker postgres15
1. 运行这个命令:$ sudo docker pull postgres:15
meiyi@meiyi-Extensa-2511G:~/Downloads$ sudo docker pull postgres:15
15: Pulling from library/postgres
e1caac4eb9d2: Pull complete
d615c5a045a4: Pull complete
3b2141deb53c: Pull complete
75e75606e68e: Pull complete
413751f5b5b0: Pull complete
9c890e547474: Pull complete
42acbdd37ae0: Pull complete
3564be86b294: Pull complete
92ce85b89d40: Pull complete
50ef3e06398b: Pull complete
00d110c38cdf: Pull complete
54abd977e238: Pull complete
947d2ae74cb3: Pull complete
a65b641a5e1e: Pull complete
Digest: sha256:4f384de91036814d3255ca697ee61c7c036204f723461adbc36b1404b20323e6
Status: Downloaded newer image for postgres:15
docker.io/library/postgres:15
2. 创建数据+密码
运行这个命令:$ docker run -e POSTGRES_PASSWORD=abdfdd3859a24c -d postgres
docker run -e POSTGRES_PASSWORD=abdfdd3859a24c -d postgres
docker: permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock: Post "http://%2Fvar%2Frun%2Fdocker.sock/v1.24/containers/create": dial unix /var/run/docker.sock: connect: permission denied.
See 'docker run --help'.
会报错,使用 Docker 命令时遇到了权限问题。这是由于您在没有足够权限的情况下尝试执行 Docker 命令导致的。
在命令前面加上sudo,再重新运行:$ sudo docker run -e POSTGRES_PASSWORD=abdfdd3859a24c -d postgres
$ sudo docker run -e POSTGRES_PASSWORD=abdfdd3859a24c -d postgres
Unable to find image 'postgres:latest' locally
latest: Pulling from library/postgres
e1caac4eb9d2: Already exists
7a2930f13d47: Pull complete
a6c49e965138: Pull complete
ed8dc94f857d: Pull complete
1f07b4807698: Pull complete
a776288d4030: Pull complete
7cbb4adb3448: Pull complete
b6dbd7317d5f: Pull complete
52814b5dc710: Pull complete
b68697689b55: Pull complete
6d80681e3923: Pull complete
4270a9f40aee: Pull complete
d28fa0286314: Pull complete
cb1ee5bc271e: Pull complete
Digest: sha256:f58300ac8d393b2e3b09d36ea12d7d24ee9440440e421472a300e929ddb63460
Status: Downloaded newer image for postgres:latest
c9a07226ef7f634df9eb90fb2a4ad54c3f176d7112ea1db46987892e13d2b959
3. 运行 docker ps查看一下,是否安装成功
$ docker ps
permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock: Get "http://%2Fvar%2Frun%2Fdocker.sock/v1.24/containers/json": dial unix /var/run/docker.sock: connect: permission denied
也会报错说权限问题
在命令前面加上sudo,再重新运行:$ sudo docker ps
meiyi@meiyi-Extensa-2511G:~/Downloads$ sudo docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
c9a07226ef7f postgres "docker-entrypoint.s…" About a minute ago Up About a minute 5432/tcp agitated_murdock
就安装成功了
登录
请登录后再发表评论。
评论列表:
目前还没有人发表评论