ERROR: for postgres14.3 Cannot kill container:

配置好数据库,选择postgres13.4

version: '3' services:
  postgres14.3:
    container_name: "postgres14.3"
    image: postgres:14.3
    volumes:
      - /workspace/docker_folder2/postgres14.3:/var/lib/postgresql/data
    command: 'tail -F /dev/null'
      # command: 'postgres'
    ports:
      - "5532:5432"
    stdin_open: true
    tty: true
    environment:  #这些内容仅在第一次创建docker的时候有用
      - POSTGRES_DB=postgres
      - POSTGRES_USER=postgres
      - POSTGRES_PASSWORD=88888888

sudo docker-compose up

在运行docker连接数据库的过程,出现报错

postgres14.3    | 2022-06-02 02:30:31.317 UTC [89] FATAL:  password authentication failed for user "postgresql"
postgres14.3    | 2022-06-02 02:30:31.317 UTC [89] DETAIL:  Role "postgresql" does not exist.
postgres14.3    |     Connection matched pg_hba.conf line 100: "host all all all scram-sha-256"
^CGracefully stopping... (press Ctrl+C again to force)
Stopping postgres14.3   ...
Killing postgres14.3    ... error

ERROR: for postgres14.3  Cannot kill container: c9d54c6d1198d0969692286d6a841a35c82425bd602a6e7d6538f50047e676c6: Container c9d54c6d1198d0969692286d6a841a35c82425bd602a6e7d6538f50047e676c6 is not running
ERROR: 2

首先使用命令export DOCKER_DEFAULT_PLATFORM=linux/amd64

然后执行sudo docker-compose up

会出现同样的报错,查看配置文件,进行command的注释,把command进行替换注释,就可以了

sudo docker-compose up
WARNING: Found orphan containers (test_rails_crud_db_1, test_rails_crud_web_1) for this project. If you removed or renamed this service in your compose file, you can run this command with the --remove-orphans flag to clean it up.
Recreating postgres14.3 ... done
Attaching to postgres14.3

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值