Sollosa
Sollosa

Reputation: 431

Building MySQL image from base image with docker build?

I'm newbie to Docker. What's the convenient way to build a MySQL image from a Dockerfile

I can install MySQL with RUN directive and enable and start its service too. But how to do post-installation operations? I mean mysql_secure-installation? And auto-respond to its prompt of password & remove test dbs etc?

Upvotes: 1

Views: 382

Answers (1)

Frank Yucheng Gu
Frank Yucheng Gu

Reputation: 1889

A good place to start is the official MySQL Server image. Unless you have a very specific use-case justifying the need to build the MySQL container image, you should try to use existing images since they are usually maintained by the upstream developers and somewhat tested.

Regarding post-install operations (eg. securing and/or seeding the DB), you can create a custom container image based on the mysql image. Simply add RUN commands to execute additional steps to add to your container image.

Upvotes: 1

Related Questions