默认上MariaDB的包并没有在Ubuntu仓库中。要安装MariaDB,我们首先要设置MariaDB仓库。
配置MariaDB 仓库
# apt-get install software-properties-common
# apt-key adv --recv-keys --keyserver hkp://keyserver.ubuntu.com:80 0xcbcb082a1bb943db
# add-apt-repository 'deb trusty main'
默认上MariaDB的包并没有在Ubuntu仓库中。要安装MariaDB,我们首先要设置MariaDB仓库。
# apt-get update
命中:1 xenial InRelease
获取:2 trusty InRelease [3,234 B]
忽略:3 stable InRelease
获取:4 trusty/main amd64 Packages [5,626 B]
命中:5 stable Release
命中:6 https://apt.dockerproject.org/repo ubuntu-xenial InRelease
获取:8 trusty/main i386 Packages [5,627 B]
命中:9 xenial InRelease
命中:10 xenial InRelease
已下载 14.5 kB,耗时 6秒 (2,272 B/s)
正在读取软件包列表... 完成
W: : 密钥 199369E5404BD5FC7D2FE43BCBCB082A1BB943DB 生成的数字签名使用了弱安全性摘要算法(SHA1)
Build Dockerfile
# docker build .
Sending build context to Docker daemon 7.68 kB
Step 1 : FROM ××××××
---> b3b17be3a5e6
Step 2 : MAINTAINER ××××××× <×××××@qq.com>
---> Using cache
---> 73d23501f6f0
Step 3 : ENV DATA_DIR /var/lib/mysql
---> Using cache
---> ad11a90574d3
Step 4 : RUN apt-get install -y mariadb-server && apt-get clean all
---> Running in c3d3c5af1bd0
Reading package lists...
Building dependency tree...
Reading state information...
The following extra packages will be installed:
libaio1 libdbd-mysql-perl libdbi-perl libhtml-template-perl
libmariadbclient18 libmysqlclient18 libreadline5 libterm-readkey-perl
mariadb-client-5.5 mariadb-client-core-5.5 mariadb-common mariadb-server-5.5
mariadb-server-core-5.5 mysql-common psmisc
Suggested packages:
libclone-perl libmldbm-perl libnet-daemon-perl libplrpc-perl
libsql-statement-perl libipc-sharedcache-perl mailx mariadb-test tinyca
The following NEW packages will be installed:
libaio1 libdbd-mysql-perl libdbi-perl libhtml-template-perl
libmariadbclient18 libmysqlclient18 libreadline5 libterm-readkey-perl
mariadb-client-5.5 mariadb-client-core-5.5 mariadb-common mariadb-server
mariadb-server-5.5 mariadb-server-core-5.5 mysql-common psmisc
0 upgraded, 16 newly installed, 0 to remove and 88 not upgraded.
Need to get 11.7 MB of archives.
After this operation, 119 MB of additional disk space will be used.
Removing intermediate container cbe87abd3e25
Successfully built ca71e9f40ecf
查看生成的images
# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
××× ×××× ca71e9f40ecf 42 seconds ago 620.3 MB
CentOS系统使用yum安装MariaDB数据库
Ubuntu 上如何将 MySQL 5.5 数据库迁移到 MariaDB 10