所以我的最终目标是运行一个MySQL Docker容器(从公共注册表中读取tutum / mysql),然后将一个Gitlab Docker容器(比如sameersbn / gitlab)链接到两个容器都使用持久存储的容器。 >
但是,我被困在MySQL部分。每次尝试运行一个预先制作的MySQL Docker容器(mysql,tutum / mysql和sameersbn / mysql),如下所示,我得到以下输出。
步骤
这只是获取以下错误消息的一种方法
输出:
root @ 1bbeb34f3491:/#mysqld
140730 4:49:04 [警告]使用唯一的选项前缀key_buffer而不是key_buffer_size已被弃用,将被删除未来发布。请使用全名。
140730 4:49:04 [警告]使用唯一的选项前缀myisam-recover而不是myisam-recover-options已弃用,在将来的版本中删除。请改用全名。
140730 4:49:04 [注意]插件'FEDERATED'被禁用。
mysqld: mysql.plugin'不存在
140730 4:49:04 [错误]无法打开mysql.plugin表。请运行mysql_upgrade来创建它。
140730 4:49:04 InnoDB:InnoDB内存堆已禁用
140730 4:49:04 InnoDB:Mutexes和rw_locks使用GCC原子内建
140730 4:49:04 InnoDB:压缩表使用zlib 1.2.8
140730 4:49:04 InnoDB:使用Linux本机AIO
140730 4:49:04 InnoDB:初始化缓冲池, size = 128.0M
140730 4:49:04 InnoDB:完成缓冲池初始化
140730 4: 49:04 InnoDB:最受支持的文件格式是Barracuda。
140730 4:49:04 InnoDB:等待后台线程开始
140730 4:49:05 InnoDB:5.5.37开始;日志序列号1595675
140730 4:49:05 [注意]服务器主机名(bind-address):'0.0.0.0';端口:3306
140730 4:49:05 [注意] - '0.0.0.0'解析为0.0.0.0;
140730 4:49:05 [注意]在IP上创建的服务器套接字:'0.0.0.0'。
140730 4:49:05 [ERROR ]无法启动服务器:绑定在unix套接字:权限被拒绝
140730 4:49:05 [错误]您是否已经有另一个mysqld服务器在套接字上运行:/ var / run / mysqld / mysqld.sock?
140730 4:49:05 [错误]中止
140730 4:49:05 InnoDB:开始关机... 140730 4:49:06 InnoDB:关机完成;日志序列号1595675 140730 4:49:06 [注意] mysqld:关闭完成
解决错误
- 请运行mysql_upgrade创建它=>运行mysql_upgrade命令输出
root @ 1bbeb34f3491:/#mysql_upgrade
寻找'mysql'为: mysql
寻找'mysqlcheck'为:mysqlcheck
致命错误:升级失败
- 你已经有另一个mysqld服务器在套接字上运行=>不是。运行服务mysql stop什么也不做,运行ps不显示mysqld。运行ls -a / var / run / mysqld /表示套接字文件不存在。
无论哪个MySQL容器尝试,最终当我启动MySQL同样的错误信息出现。这几乎肯定意味着我的设置有问题,这使我感到困惑,因为我认为一个Docker容器,没有暴露的端口或永久存储,将被隔离系统Docker安装在哪里?
我也尝试运行一个带有-d标志的MySQL容器,然后运行一个链接到它的新的ubuntu 14.04容器(docker.io run -it -link mysql:mysql ubuntu:14.04 bash)。在Ubuntu容器上,我通过apt-get安装了mysql-client,并尝试连接到MYSQL_PORT_3306_TCP_ADDR中的IP地址上的MySQL容器,但这也不行。
同样的问题可能是我不明白Docker如何工作。如果是这种情况,有人可以创建一组步骤,使用Docker索引上的一个MySQL容器,然后将容器链接到可以连接的容器。这也有助于查看我的Docker安装是否有问题(或者是导致此问题的其他一些未知问题)。
我的主机系统正在运行Ubuntu 14.04,Docker是通过apt-get安装的,是0.9.1版。
我不太确定这个解释是什么,因为这个问题对我来说似乎很奇怪。如果有什么我错过了请问,我会为你添加。
谢谢, JamesStewy
解决方案这对我有用: docker run -d -p 3306:3306 -e MYSQL_PASS =mypasstutum / mysql
不需要从bash运行脚本,不需要任何聪明的东西。
So my ultimate end goal is to run a MySQL Docker container (say tutum/mysql from the public registry) and then link a Gitlab Docker container (say sameersbn/gitlab) to it where both containers use persistent storage.
However, I am stuck on the MySQL part. Every time I try and run a pre-made MySQL Docker container (mysql, tutum/mysql and sameersbn/mysql) as outlined below, I get the below output.
Steps
This is just one way of getting to the error message below.
Output:
root@1bbeb34f3491:/# mysqld
140730 4:49:04 [Warning] Using unique option prefix key_buffer instead of key_buffer_size is deprecated and will be removed in a future release. Please use the full name instead.
140730 4:49:04 [Warning] Using unique option prefix myisam-recover instead of myisam-recover-options is deprecated and will be removed in a future release. Please use the full name instead.
140730 4:49:04 [Note] Plugin 'FEDERATED' is disabled.
mysqld: Table 'mysql.plugin' doesn't exist
140730 4:49:04 [ERROR] Can't open the mysql.plugin table. Please run mysql_upgrade to create it.
140730 4:49:04 InnoDB: The InnoDB memory heap is disabled
140730 4:49:04 InnoDB: Mutexes and rw_locks use GCC atomic builtins
140730 4:49:04 InnoDB: Compressed tables use zlib 1.2.8
140730 4:49:04 InnoDB: Using Linux native AIO
140730 4:49:04 InnoDB: Initializing buffer pool, size = 128.0M
140730 4:49:04 InnoDB: Completed initialization of buffer pool
140730 4:49:04 InnoDB: highest supported file format is Barracuda.
140730 4:49:04 InnoDB: Waiting for the background threads to start
140730 4:49:05 InnoDB: 5.5.37 started; log sequence number 1595675
140730 4:49:05 [Note] Server hostname (bind-address): '0.0.0.0'; port: 3306
140730 4:49:05 [Note] - '0.0.0.0' resolves to '0.0.0.0';
140730 4:49:05 [Note] Server socket created on IP: '0.0.0.0'.
140730 4:49:05 [ERROR] Can't start server : Bind on unix socket: Permission denied
140730 4:49:05 [ERROR] Do you already have another mysqld server running on socket: /var/run/mysqld/mysqld.sock ?
140730 4:49:05 [ERROR] Aborting
140730 4:49:05 InnoDB: Starting shutdown... 140730 4:49:06 InnoDB: Shutdown completed; log sequence number 1595675 140730 4:49:06 [Note] mysqld: Shutdown complete
Addressing the errors
- "Please run mysql_upgrade to create it" => run mysql_upgrade command which outputs
root@1bbeb34f3491:/# mysql_upgrade
Looking for 'mysql' as: mysql
Looking for 'mysqlcheck' as: mysqlcheck
FATAL ERROR: Upgrade failed
- "Do you already have another mysqld server running on socket" => Nope. Running service mysql stop does nothing and running ps doesn't show mysqld. Running ls -a /var/run/mysqld/ suggests that the socket file doesn't exist.
No matter which MySQL container I try, eventually when I start MySQL the same error message came up. This almost certainly means there is something wrong with my setup which confuses me because I thought a Docker container, with no exposed ports or persistent storage, would be isolated from the system Docker is installed on?
I have also tried running a MySQL container with the -d flag then running a fresh ubuntu 14.04 container (docker.io run -it --link mysql:mysql ubuntu:14.04 bash) linked to it. On the Ubuntu container I installed mysql-client through apt-get and tried to connect to the MySQL container on the ip address in MYSQL_PORT_3306_TCP_ADDR but that doesn't work either.
Equally the problem might be that I do not understand how Docker works. If this is the case, can someone create a set of steps that uses one of the MySQL containers on the Docker index and then link a container to it that can connect. This will also help to see whether there is something wrong with my Docker installation (or some other unknown problem that is causing this issue).
My host system is running Ubuntu 14.04 and Docker was installed through apt-get and is version 0.9.1.
I wasn't quite sure what to put in this explanation because the problem seems quite weird to me. If there is anything I have missed please ask and I will add it for you.
Thanks, JamesStewy
解决方案This works for me: docker run -d -p 3306:3306 -e MYSQL_PASS="mypass" tutum/mysql
No need to run the script from bash, no need for anything clever.
更多推荐
在Docker容器中运行MySQL
发布评论