Get the App
SLTechnology News&Howtos  ›  Development  › 

How to build mysql Image through Dockerfile by docker

Shulou Source: shulou.com Published: 2022-05-31 16:25:55 11月13日 Update

This article focuses on "how to build a mysql image through docker through Dockerfile". Interested friends may wish to take a look. The method introduced in this paper is simple, fast and practical. Let's let the editor take you to learn "how docker builds mysql images through Dockerfile".

Build Dockerfile, path / docker/mysql

FROM hub.c.163.com/library/mysql:5.7# author Information MAINTAINER hu "* * @ qq.com" # modify the encoding method RUN echo "character-set-server=utf8" > > / etc/mysql/mysql.conf.d/mysqld.cnfRUN service mysql restartEXPOSE 3306

Go to the folder where Dockerfile is located and execute, don't forget the last period

Docker build-t my/mysql:v1.

View Mirror

Docker images

Delete Mirror

Docker rmi docker rmi-f 9e64176cd8a2 # Force deletion of docker rmi $(docker images-Q) # Delete all mirrors

Start

Docker run-- name mymysql-p 3306 MYSQL_ROOT_PASSWORD=root-d my/mysql

Enter the container

Docker exec-it mymysql bash enters the container here. I believe you have a better understanding of "how docker builds mysql images through Dockerfile". You might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!

Tags: Mirror content container learning practical deeper author information interest practicality practicality location simple operation files folders methods methods more friends coding Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno NVidia Huawei Apple Docker MySQL