-rn to remove the container when it is stopped.-name to name the container basic-mysql.First, we created a directory called mysql-data in /tmp to store the data of MySQL. Let’s analyze the command we just ran to run MySQL with docker. To run the MySQL 8.0 container using the official image, simply run the following command: mkdir /tmp/mysql-dataĭocker run -name basic-mysql -rm -v /tmp/mysql-data:/var/lib/mysql -e MYSQL_ROOT_PASSWORD =ANSKk08aPEDbFjDO -e MYSQL_DATABASE =testing -p 3306:3306 -it mysql:8.0 The official MySQL Docker image does not have an Alpine Linux version, still, the Debian version is also 147 MB which is not too big for a docker image. Run MySQL with Docker #įor this beginners’ guide, we will use the official MySQL Docker image from DockerHub. Now as you are aware of the prerequisites, we can dive deeper into the CLI commands and any related code. For this tutorial, we will use an existing API with Node.js and MySQL which will replace the remote MySQL with a local MySQL running with Docker and Docker Compose.A general understanding of how relational databases work, specifically MySQL will be advantageous.Any prior information about Docker-compose will be very useful, we will use docker-compose version 1.29.2, build 5becea4c in the examples.In the examples, we will use Docker version 20.10.10, build b485636 on a Mac. Basic knowledge of Docker and related commands like docker build, run, execute, etc will be useful for this guide.Prerequisites #īefore we get our hands dirty with some code and CLI commands, below are some good to have prerequisites: In the next section, we will list out some good to have things prior to jumping into the code to run MySQL with Docker. To know the above reasons in a bit more detail please do read the why use docker post. A new team member can be productive in hours, not days given docker and other tools are set up in an efficient way.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |