DOCKER COMMANDS
-
docker images
OUTPUT: $ docker images REPOSITORY TAG IMAGE ID CREATED SIZE harikanure007/springboot-swagger latest 5c3f70a90ae7 21 minutes ago 351MB springboot-swagger latest 5c3f70a90ae7 21 minutes ago 351MB tomcat latest 405afe63d576 44 hours ago 455MB hello-world latest d2c94e258dcb 10 months ago 13.3kB
-
Create DockerFile inside project directory(Named with DockerFile and without any extension)
FROM openjdk:17-jdk-alpine EXPOSE 8080 ADD target/springboot-swagger-0.0.1-SNAPSHOT.jar springboot-swagger.jar ENTRYPOINT ["java","-jar","/springboot-swagger.jar"]
-
Create application jar file by "mvn clean install"
-
docker build -t springboot-swagger:latest .
-
docker run -d -p 8080:8080 springboot-swagger
-
docker stop 843f1a70a9fd
-
docker login -u [email protected] -p XXXX docker.io
-
docker tag springboot-swagger:latest harikanure007/springboot-swagger -- if not set the tag then we may get access denied error.
-
docker push harikanure007/springboot-swagger
Docker commands for local mysql deployment
- docker pull mysql
- docker run -p 3307:3306 --name mysqlcontainer -e MYSQL_ROOT_PASSWORD=root -e MYSQL_DATABASE=traveldev mysql
- winpty docker exec -it mysqlcontainer bash -l
- mysql -uroot -proot -hlocalhost -P3307