我是靠谱客的博主 懦弱画板,最近开发中收集的这篇文章主要介绍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

最后

以上就是懦弱画板为你收集整理的ERROR: for postgres14.3 Cannot kill container:的全部内容,希望文章能够帮你解决ERROR: for postgres14.3 Cannot kill container:所遇到的程序开发问题。

如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(64)

评论列表共有 0 条评论

立即
投稿
返回
顶部