Last login: Wed Sep  9 09:19:46 on ttys002

The default interactive shell is now zsh.
To update your account to use zsh, please run `chsh -s /bin/zsh`.
For more details, please visit https://support.apple.com/kb/HT208050.
bogon:~ xiwenlu$ ssh root@00.00.00.0
root@00.00.00.0's password: 
Last login: Wed Sep  9 09:20:32 2020 from 00.00.00.0
[root@VM-0-10-centos ~]# docker ps -a
CONTAINER ID        IMAGE                 COMMAND                  CREATED             STATUS              PORTS                                              NAMES
eeadee04137b        nginx                 "/docker-entrypoint.…"   41 hours ago        Up 41 hours         0.0.0.0:80->80/tcp                                 nginx-test-web
de700cb36f69        jenkinsci/blueocean   "/sbin/tini -- /usr/…"   45 hours ago        Up 41 hours         0.0.0.0:8080->8080/tcp, 0.0.0.0:50000->50000/tcp   serene_wiles
ec2143b01d5a        postgres:9.6          "docker-entrypoint.s…"   46 hours ago        Up 12 minutes       0.0.0.0:5432->5432/tcp                             postgres
[root@VM-0-10-centos ~]# docker exec -it ec2143b01d5a bash
root@ec2143b01d5a:/# su postgres
postgres@ec2143b01d5a:/$ psql
psql (9.6.19)
Type "help" for help.

postgres=# ALTER USER postgres WITH PASSWORD '123456';
ALTER ROLE
postgres=# \q
postgres@ec2143b01d5a:/$ 




  1. 进入容器:docker exec -it ec2143b01d5a bash
  2. 使用postgres登录:su postgres
  3. 连接数据库:psql -U postgres
  4. 修改postgres用户密码:Alter user postgres with password ‘123456’;
  5. 退出数据库连接:\q
Logo

权威|前沿|技术|干货|国内首个API全生命周期开发者社区

更多推荐