ubuntu 16.04 Dockerfile 安装mysql
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了ubuntu 16.04 Dockerfile 安装mysql相关的知识,希望对你有一定的参考价值。
默认上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 http://sfo1.mirrors.digitalocean.com/mariadb/repo/10.0/ubuntu trusty main‘
默认上MariaDB的包并没有在Ubuntu仓库中。要安装MariaDB,我们首先要设置MariaDB仓库。
# apt-get update
命中:1 http://cn.archive.ubuntu.com/ubuntu xenial InRelease
获取:2 http://sfo1.mirrors.digitalocean.com/mariadb/repo/10.0/ubuntu trusty InRelease [3,234 B]
忽略:3 http://dl.google.com/linux/chrome/deb stable InRelease
获取:4 http://sfo1.mirrors.digitalocean.com/mariadb/repo/10.0/ubuntu trusty/main amd64 Packages [5,626 B]
命中:5 http://dl.google.com/linux/chrome/deb stable Release
命中:6 https://apt.dockerproject.org/repo ubuntu-xenial InRelease
获取:8 http://sfo1.mirrors.digitalocean.com/mariadb/repo/10.0/ubuntu trusty/main i386 Packages [5,627 B]
命中:9 http://ppa.launchpad.net/ansible/ansible/ubuntu xenial InRelease
命中:10 http://ppa.launchpad.net/notepadqq-team/notepadqq/ubuntu xenial InRelease
已下载 14.5 kB,耗时 6秒 (2,272 B/s)
正在读取软件包列表... 完成
W: http://sfo1.mirrors.digitalocean.com/mariadb/repo/10.0/ubuntu/dists/trusty/InRelease: 密钥 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
以上是关于ubuntu 16.04 Dockerfile 安装mysql的主要内容,如果未能解决你的问题,请参考以下文章