Last active
July 17, 2020 13:51
-
-
Save eduardolfalcao/3d008e383e2f3b67ac12518c397e3a75 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64 | |
mvn package #jar goes to target dir | |
## DOCKERFILE | |
FROM openjdk:8-jdk-alpine #or sconecuratedimages/apps:8-jdk-alpine | |
RUN apk --upgrade add maven | |
ADD . / | |
RUN mvn package | |
COPY ${JAR_FILE} app.jar | |
ENTRYPOINT ["java","-jar","/app.jar","arg1","arg2"] | |
#run dockerfile: image name must be lowercase | |
docker build --tag <image-name> . | |
#login to docker | |
docker login | |
#pull image | |
docker pull <image-name> | |
#remove created image must be lowercase | |
docker image rm <image-name> | |
#run container with given image | |
docker run <image-name> | |
#run container with given image, mapping port 8080 from host to 8080 of container | |
docker run -p 8080:8080 <image-name> | |
#open bash in container | |
docker exec -it <container_name_or_id> bash | |
#list containers | |
docker ps -a | |
#list all container and display only ids | |
docker container ps -a -q | |
#remove all stopped containers | |
docker container rm $(docker container ps -a -q) | |
#list images displaying only ids | |
docker images -q | |
#remove all images | |
docker rmi $(docker images -q) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment