![]() ![]() In the bash shell, enter the following command to invoke MySQL with the root user. This command creates a new interactive bash shell in the mysql-docker-container through -it that tells Docker to allot a pseudo-TTY connected to the container’s stdin.The docker exec command runs a new command in an already running container.sudo docker exec -it mysql-docker-container bash Next, you will run the docker exec command. Docker Command to Run MySQL Step 3: Docker exec Command With the environment variables, we have changed the root user password, named a database that will be created when the image starts up, created a user that will be granted superuser permissions for the database created, and set the password of that user.Here MYSQL_ROOT_PASSWORD, MYSQL_DATABASE, MYSQL_USER, and MYSQL_PASSWORD have been set. –name sets the name of the container i.e.-p publishes a container’s port(s) to the host.-d prints the container ID and runs the container in the background.mysql/mysql-server:latest and then starts it using the specified command. docker run command first creates a writeable container layer over the specified image i.e.docker run -d -p 3306:3306 -name mysql-docker-container -e MYSQL_ROOT_PASSWORD=sergey -e MYSQL_DATABASE=photo_app -e MYSQL_USER=sergey -e MYSQL_PASSWORD=sergey mysql/mysql-server:latest Next, you will run the docker run command. docker pull mysql/mysql-server:latest Pull MySQL Docker Image Step 2: Docker Run Command You can also specify a particular version. The first step is to pull the MySQL Docker image. Conclusion Step 1: Pull MySQL Docker Image. ![]() User Registration, Log in, Log out – Video Tutorials. ![]()
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |