My first running container

After discovering that I can’t use the default mysql docker image because MySQL doesn’t support a binary distribution on ARM, I figured that I’d have to create my own.

This should be a simple matter a preparing a Dockerfile,

FROM resin/rpi-raspbian:wheezy
# add our user and group first to make sure their IDs get assigned consistently, regardless of whatever dependencies get added
#RUN groupadd -r mysql && useradd -r -g mysql mysql
# FATAL ERROR: please install the following Perl modules before executing /usr/local/mysql/scripts/mysql_install_db:
# File::Basename
# File::Copy
# Sys::Hostname
# Data::Dumper
RUN apt-get update && apt-get install -y perl --no-install-recommends && rm -rf /var/lib/apt/lists/*
RUN apt-get update && apt-get install -y libaio1 && rm -rf /var/lib/apt/lists/*
# gpg: key 5072E1F5: public key "MySQL Release Engineering <>" imported
RUN gpg --keyserver --recv-keys A4A9406876FCBD3C456770C88C718D3B5072E1F5
# Attempt to install the mysql packages; no tarball for r-pi (arm) exists publicly
RUN apt-get update \
 && apt-get install -y mysql-server-5.5 --fix-missing \
 && rm -rf /var/lib/apt/lists/*\
 && { \
 echo '[mysqld]'; \
 echo 'user = mysql'; \
 echo 'datadir = /var/lib/mysql'; \
 } > /etc/mysql/conf.d/docker.cnf
VOLUME /var/lib/mysql
CMD ["mysqld"]

And then running the following to create the image,

# docker build -t mysql-jur/mysql:5.4.43 .

This generates a lot of output but finishes by confirming the image is built.

We then run the image with,

# docker run -p 33060:3306 -t mysql-jur/mysql:5.5.43

And now what I need to do is figure out how I connect to the container database.

Again lots of output from MySQL setting up InnoDB, etc.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s