Categories Docker

[Docker] – Important commands and scripts to work with Docker

docker container restart CONTAINER_NAME # restart docker container

Script to create an image from an other image (must be saved in Dockerfile), for example create an image from an jdk image that contains your spring boot apps.

FROM openjdk:17

WORKDIR /NEW_DIR # a available or existed directory
COPY target/YOUR_APP_NAME.jar NEW_NAME.jar
ENTRYPOINT ["java", "-jar", "app.jar"]  # to run app when start a container from your created image
docker build -t IMAGE_NAME . # to build the Dockerfile

More From Author

Leave a Reply

Your email address will not be published. Required fields are marked *