![]() It is the responsibility of the developer to create and publish (if required) the docker image of the application that he has developed. We have to create it for our application. Where we can find the docker image for the spring boot application that we have developed? Nowhere. ![]() It was easy to create a container for MySQL server as there is an already published docker image for MySQL. Now our next target is to create a container for running spring boot application.Ĭreate docker container for Spring Boot Application. Now we have a MySQL docker container up and running. The rest of the parameters are used to create the root password, database and creating the user (with username and password) for giving the access to the database. ![]() Mysql is the image name and latest represents the tag This describes the image name and the tag. In this case it is “ mysql-docker-container” Here is the screen shot of successful connection to docker container with Sequel Pro So the outsiders can access the MySQL container with host machine ip-address:2012 port. We have mapped/bind the 3306 port to the 2012 post of the host machine. Then it will be possible to access the mysql docker container through the IP and PORT of the Host machine.Ģ012:3306 :- By default MySQL server uses port 3306. Therefore we need to bind the container port to a port of the host machine. sometimes you might need to connect to MySQL container from host or some other remote sever. p flag is used for port binding between host and container. If you want the terminal access, simply avoid this flag. We use this flag to run the container in detached mode, which means that it will run in a separate background process. Lets break and understand the above “ docker run” command. name mysql-docker-container \ -e MYSQL_ROOT_PASSWORD= root123 \ -e MYSQL_DATABASE= spring_app_db \ -e MYSQL_USER= app_user \ -e MYSQL_PASSWORD= test123 \ mysql:latestĪfter running the above command it will create a docker container with name “ mysql-docker-container“. If it is not available, it will pull the image from the remote repository( Docker Hub) and create the container. It will first check the local docker registry for finding the requested mysql image. Therefore we can create the MysQL docker container executing the following command. MySQL Team has provided an official docker image of MySQL through Docker Hub.
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |