docker-compose with adminer & mariadb 在尝试连接数据库时显示 403

如何解决docker-compose with adminer & mariadb 在尝试连接数据库时显示 403

过去几个小时我一直在调试我的系统,但我对这里发生的事情一无所知。

我正在使用一个简单的 docker-compose.yml 文件在我的 Ubuntu 20.04 LTS 系统上启动一个 ma​​riadb 和一个 adminer 实例。

docker-compose.yml

version: '3'
services:
  database:
    image: mariadb
    restart: always
    environment:
      MYSQL_DATABASE: feedback
      MYSQL_USER: db_user
      MYSQL_PASSWORD: password
      MYSQL_ROOT_PASSWORD: root

  adminer:
    image: adminer
    restart: always
    environment: 
      ADMINER_DEFAULT_SERVER: database
    ports:
      - "127.0.0.1:8080:8080"

一位同事对此进行了测试,并且 100% 的时间都可以在他们的系统上运行。但是,在我的系统上的最后几个小时内进行了多次尝试中,它只成功了两次。

这是 docker-compose 输出:

Creating knowledge-base_database_1 ... done
Creating knowledge-base_adminer_1  ... done
Attaching to knowledge-base_adminer_1,knowledge-base_database_1
database_1  | 2021-05-31 12:17:04+00:00 [Note] [Entrypoint]: Entrypoint script for MariaDB Server 1:10.5.10+maria~focal started.
adminer_1   | [Mon May 31 12:17:04 2021] PHP 7.4.19 Development Server (http://[::]:8080) started
database_1  | 2021-05-31 12:17:04+00:00 [Note] [Entrypoint]: Switching to dedicated user 'mysql'
database_1  | 2021-05-31 12:17:04+00:00 [Note] [Entrypoint]: Entrypoint script for MariaDB Server 1:10.5.10+maria~focal started.
database_1  | 2021-05-31 12:17:05+00:00 [Note] [Entrypoint]: Initializing database files
database_1  | 
database_1  | 
database_1  | PLEASE REMEMBER TO SET A PASSWORD FOR THE MariaDB root USER !
database_1  | To do so,start the server,then issue the following command:
database_1  | 
database_1  | '/usr/bin/mysql_secure_installation'
database_1  | 
database_1  | which will also give you the option of removing the test
database_1  | databases and anonymous user created by default.  This is
database_1  | strongly recommended for production servers.
database_1  | 
database_1  | See the MariaDB Knowledgebase at https://mariadb.com/kb or the
database_1  | MySQL manual for more instructions.
database_1  | 
database_1  | Please report any problems at https://mariadb.org/jira
database_1  | 
database_1  | The latest information about MariaDB is available at https://mariadb.org/.
database_1  | You can find additional information about the MySQL part at:
database_1  | https://dev.mysql.com
database_1  | Consider joining MariaDB's strong and vibrant community:
database_1  | https://mariadb.org/get-involved/
database_1  | 
database_1  | 2021-05-31 12:17:06+00:00 [Note] [Entrypoint]: Database files initialized
database_1  | 2021-05-31 12:17:06+00:00 [Note] [Entrypoint]: Starting temporary server
database_1  | 2021-05-31 12:17:06+00:00 [Note] [Entrypoint]: Waiting for server startup
database_1  | 2021-05-31 12:17:06 0 [Note] mysqld (mysqld 10.5.10-MariaDB-1:10.5.10+maria~focal) starting as process 99 ...
database_1  | 2021-05-31 12:17:06 0 [Note] InnoDB: Uses event mutexes
database_1  | 2021-05-31 12:17:06 0 [Note] InnoDB: Compressed tables use zlib 1.2.11
database_1  | 2021-05-31 12:17:06 0 [Note] InnoDB: Number of pools: 1
database_1  | 2021-05-31 12:17:06 0 [Note] InnoDB: Using crc32 + pclmulqdq instructions
database_1  | 2021-05-31 12:17:06 0 [Note] mysqld: O_TMPFILE is not supported on /tmp (disabling future attempts)
database_1  | 2021-05-31 12:17:06 0 [Note] InnoDB: Using Linux native AIO
database_1  | 2021-05-31 12:17:06 0 [Note] InnoDB: Initializing buffer pool,total size = 134217728,chunk size = 134217728
database_1  | 2021-05-31 12:17:06 0 [Note] InnoDB: Completed initialization of buffer pool
database_1  | 2021-05-31 12:17:06 0 [Note] InnoDB: 128 rollback segments are active.
database_1  | 2021-05-31 12:17:06 0 [Note] InnoDB: Creating shared tablespace for temporary tables
database_1  | 2021-05-31 12:17:06 0 [Note] InnoDB: Setting file './ibtmp1' size to 12 MB. Physically writing the file full; Please wait ...
database_1  | 2021-05-31 12:17:06 0 [Note] InnoDB: File './ibtmp1' size is now 12 MB.
database_1  | 2021-05-31 12:17:06 0 [Note] InnoDB: 10.5.10 started; log sequence number 45118; transaction id 20
database_1  | 2021-05-31 12:17:06 0 [Note] Plugin 'FEEDBACK' is disabled.
database_1  | 2021-05-31 12:17:06 0 [Note] InnoDB: Loading buffer pool(s) from /var/lib/mysql/ib_buffer_pool
database_1  | 2021-05-31 12:17:06 0 [Note] InnoDB: Buffer pool(s) load completed at 210531 12:17:06
database_1  | 2021-05-31 12:17:06 0 [Warning] 'user' entry 'root@5315aa145a33' ignored in --skip-name-resolve mode.
database_1  | 2021-05-31 12:17:06 0 [Warning] 'proxies_priv' entry '@% root@5315aa145a33' ignored in --skip-name-resolve mode.
database_1  | 2021-05-31 12:17:06 0 [Note] Reading of all Master_info entries succeeded
database_1  | 2021-05-31 12:17:06 0 [Note] Added new Master_info '' to hash table
database_1  | 2021-05-31 12:17:06 0 [Note] mysqld: ready for connections.
database_1  | Version: '10.5.10-MariaDB-1:10.5.10+maria~focal'  socket: '/run/mysqld/mysqld.sock'  port: 0  mariadb.org binary distribution
database_1  | 2021-05-31 12:17:07+00:00 [Note] [Entrypoint]: Temporary server started.
database_1  | Warning: Unable to load '/usr/share/zoneinfo/leap-seconds.list' as time zone. Skipping it.
database_1  | Warning: Unable to load '/usr/share/zoneinfo/leapseconds' as time zone. Skipping it.
database_1  | Warning: Unable to load '/usr/share/zoneinfo/tzdata.zi' as time zone. Skipping it.
database_1  | 2021-05-31 12:17:09 5 [Warning] 'proxies_priv' entry '@% root@5315aa145a33' ignored in --skip-name-resolve mode.
database_1  | 2021-05-31 12:17:09+00:00 [Note] [Entrypoint]: Creating database feedback
database_1  | 2021-05-31 12:17:09+00:00 [Note] [Entrypoint]: Creating user db_user
database_1  | 2021-05-31 12:17:09+00:00 [Note] [Entrypoint]: Giving user db_user access to schema feedback
database_1  | 
database_1  | 2021-05-31 12:17:09+00:00 [Note] [Entrypoint]: Stopping temporary server
database_1  | 2021-05-31 12:17:09 0 [Note] mysqld (initiated by: root[root] @ localhost []): Normal shutdown
database_1  | 2021-05-31 12:17:09 0 [Note] Event Scheduler: Purging the queue. 0 events
database_1  | 2021-05-31 12:17:09 0 [Note] InnoDB: FTS optimize thread exiting.
database_1  | 2021-05-31 12:17:09 0 [Note] InnoDB: Starting shutdown...
database_1  | 2021-05-31 12:17:09 0 [Note] InnoDB: Dumping buffer pool(s) to /var/lib/mysql/ib_buffer_pool
database_1  | 2021-05-31 12:17:09 0 [Note] InnoDB: Buffer pool(s) dump completed at 210531 12:17:09
database_1  | 2021-05-31 12:17:09 0 [Note] InnoDB: Removed temporary tablespace data file: "ibtmp1"
database_1  | 2021-05-31 12:17:09 0 [Note] InnoDB: Shutdown completed; log sequence number 45130; transaction id 21
database_1  | 2021-05-31 12:17:09 0 [Note] mysqld: Shutdown complete
database_1  | 
database_1  | 2021-05-31 12:17:10+00:00 [Note] [Entrypoint]: Temporary server stopped
database_1  | 
database_1  | 2021-05-31 12:17:10+00:00 [Note] [Entrypoint]: MariaDB init process done. Ready for start up.
database_1  | 
database_1  | 2021-05-31 12:17:10 0 [Note] mysqld (mysqld 10.5.10-MariaDB-1:10.5.10+maria~focal) starting as process 1 ...
database_1  | 2021-05-31 12:17:10 0 [Note] InnoDB: Uses event mutexes
database_1  | 2021-05-31 12:17:10 0 [Note] InnoDB: Compressed tables use zlib 1.2.11
database_1  | 2021-05-31 12:17:10 0 [Note] InnoDB: Number of pools: 1
database_1  | 2021-05-31 12:17:10 0 [Note] InnoDB: Using crc32 + pclmulqdq instructions
database_1  | 2021-05-31 12:17:10 0 [Note] mysqld: O_TMPFILE is not supported on /tmp (disabling future attempts)
database_1  | 2021-05-31 12:17:10 0 [Note] InnoDB: Using Linux native AIO
database_1  | 2021-05-31 12:17:10 0 [Note] InnoDB: Initializing buffer pool,chunk size = 134217728
database_1  | 2021-05-31 12:17:10 0 [Note] InnoDB: Completed initialization of buffer pool
database_1  | 2021-05-31 12:17:10 0 [Note] InnoDB: 128 rollback segments are active.
database_1  | 2021-05-31 12:17:10 0 [Note] InnoDB: Creating shared tablespace for temporary tables
database_1  | 2021-05-31 12:17:10 0 [Note] InnoDB: Setting file './ibtmp1' size to 12 MB. Physically writing the file full; Please wait ...
database_1  | 2021-05-31 12:17:10 0 [Note] InnoDB: File './ibtmp1' size is now 12 MB.
database_1  | 2021-05-31 12:17:10 0 [Note] InnoDB: 10.5.10 started; log sequence number 45130; transaction id 20
database_1  | 2021-05-31 12:17:10 0 [Note] Plugin 'FEEDBACK' is disabled.
database_1  | 2021-05-31 12:17:10 0 [Note] InnoDB: Loading buffer pool(s) from /var/lib/mysql/ib_buffer_pool
database_1  | 2021-05-31 12:17:10 0 [Note] InnoDB: Buffer pool(s) load completed at 210531 12:17:10
database_1  | 2021-05-31 12:17:10 0 [Note] Server socket created on IP: '::'.
database_1  | 2021-05-31 12:17:10 0 [Warning] 'proxies_priv' entry '@% root@5315aa145a33' ignored in --skip-name-resolve mode.
database_1  | 2021-05-31 12:17:10 0 [Note] Reading of all Master_info entries succeeded
database_1  | 2021-05-31 12:17:10 0 [Note] Added new Master_info '' to hash table
database_1  | 2021-05-31 12:17:10 0 [Note] mysqld: ready for connections.
database_1  | Version: '10.5.10-MariaDB-1:10.5.10+maria~focal'  socket: '/run/mysqld/mysqld.sock'  port: 3306  mariadb.org binary distribution

尝试使用 root:root 以管理员身份登录数据库会产生以下输出:

adminer_1   | [Mon May 31 12:17:54 2021] [::ffff:172.25.0.1]:38170 Accepted
adminer_1   | [Mon May 31 12:17:54 2021] [::ffff:172.25.0.1]:38170 [302]: POST /?server=database&username=root
adminer_1   | [Mon May 31 12:17:54 2021] [::ffff:172.25.0.1]:38170 Closing
adminer_1   | [Mon May 31 12:17:54 2021] [::ffff:172.25.0.1]:38174 Accepted
adminer_1   | [Mon May 31 12:18:24 2021] [::ffff:172.25.0.1]:38174 [403]: GET /?server=database&username=root
adminer_1   | [Mon May 31 12:18:24 2021] [::ffff:172.25.0.1]:38174 Closing
adminer_1   | [Mon May 31 12:18:24 2021] [::ffff:172.25.0.1]:38208 Accepted
adminer_1   | [Mon May 31 12:18:24 2021] [::ffff:172.25.0.1]:38208 [200]: GET /?file=favicon.ico&version=4.8.0
adminer_1   | [Mon May 31 12:18:24 2021] [::ffff:172.25.0.1]:38208 Closing

我尝试过禁用防火墙、重新安装 docker 和 docker-compose、使用 docker 创建自定义网络而不是使用 docker-compose 的默认网络等。

我还在我的系统上启动了一个已知的工作项目,它产生了相同的结果。我系统上的某些东西似乎坏了,但我不知道去哪里找了。

有没有人有任何想法我可以尝试使其工作?

解决方法

尝试附加 /index.php,而不是 http://localhost 转到 http://localhost/index.php

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐


依赖报错 idea导入项目后依赖报错,解决方案:https://blog.csdn.net/weixin_42420249/article/details/81191861 依赖版本报错:更换其他版本 无法下载依赖可参考:https://blog.csdn.net/weixin_42628809/a
错误1:代码生成器依赖和mybatis依赖冲突 启动项目时报错如下 2021-12-03 13:33:33.927 ERROR 7228 [ main] o.s.b.d.LoggingFailureAnalysisReporter : *************************** APPL
错误1:gradle项目控制台输出为乱码 # 解决方案:https://blog.csdn.net/weixin_43501566/article/details/112482302 # 在gradle-wrapper.properties 添加以下内容 org.gradle.jvmargs=-Df
错误还原:在查询的过程中,传入的workType为0时,该条件不起作用 <select id="xxx"> SELECT di.id, di.name, di.work_type, di.updated... <where> <if test=&qu
报错如下,gcc版本太低 ^ server.c:5346:31: 错误:‘struct redisServer’没有名为‘server_cpulist’的成员 redisSetCpuAffinity(server.server_cpulist); ^ server.c: 在函数‘hasActiveC
解决方案1 1、改项目中.idea/workspace.xml配置文件,增加dynamic.classpath参数 2、搜索PropertiesComponent,添加如下 <property name="dynamic.classpath" value="tru
删除根组件app.vue中的默认代码后报错:Module Error (from ./node_modules/eslint-loader/index.js): 解决方案:关闭ESlint代码检测,在项目根目录创建vue.config.js,在文件中添加 module.exports = { lin
查看spark默认的python版本 [root@master day27]# pyspark /home/software/spark-2.3.4-bin-hadoop2.7/conf/spark-env.sh: line 2: /usr/local/hadoop/bin/hadoop: No s
使用本地python环境可以成功执行 import pandas as pd import matplotlib.pyplot as plt # 设置字体 plt.rcParams['font.sans-serif'] = ['SimHei'] # 能正确显示负号 p
错误1:Request method ‘DELETE‘ not supported 错误还原:controller层有一个接口,访问该接口时报错:Request method ‘DELETE‘ not supported 错误原因:没有接收到前端传入的参数,修改为如下 参考 错误2:cannot r
错误1:启动docker镜像时报错:Error response from daemon: driver failed programming external connectivity on endpoint quirky_allen 解决方法:重启docker -> systemctl r
错误1:private field ‘xxx‘ is never assigned 按Altʾnter快捷键,选择第2项 参考:https://blog.csdn.net/shi_hong_fei_hei/article/details/88814070 错误2:启动时报错,不能找到主启动类 #
报错如下,通过源不能下载,最后警告pip需升级版本 Requirement already satisfied: pip in c:\users\ychen\appdata\local\programs\python\python310\lib\site-packages (22.0.4) Coll
错误1:maven打包报错 错误还原:使用maven打包项目时报错如下 [ERROR] Failed to execute goal org.apache.maven.plugins:maven-resources-plugin:3.2.0:resources (default-resources)
错误1:服务调用时报错 服务消费者模块assess通过openFeign调用服务提供者模块hires 如下为服务提供者模块hires的控制层接口 @RestController @RequestMapping("/hires") public class FeignControl
错误1:运行项目后报如下错误 解决方案 报错2:Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.1:compile (default-compile) on project sb 解决方案:在pom.
参考 错误原因 过滤器或拦截器在生效时,redisTemplate还没有注入 解决方案:在注入容器时就生效 @Component //项目运行时就注入Spring容器 public class RedisBean { @Resource private RedisTemplate<String
使用vite构建项目报错 C:\Users\ychen\work>npm init @vitejs/app @vitejs/create-app is deprecated, use npm init vite instead C:\Users\ychen\AppData\Local\npm-