Docker for devs with hands-on| Part-4

FROM ubuntu:latest
MAINTAINER Aditya Goel "adityagoel123@gmail.com"
RUN apt-get update && apt-get install -y openjdk-8-jdk
CMD ["/bin/bash"]
docker image build -t image-from-docker-file .
docker images
docker container ps
docker container run -ti image-from-docker-file
docker container ps -a
FROM ubuntu:latest
MAINTAINER Aditya Goel "adityagoel123@gmmail.com"
RUN apt-get update && apt-get install -y openjdk-8-jdk
COPY simple-java.jar /usr/local/bin/
CMD ["/bin/bash"]
FROM ubuntu:latest
MAINTAINER Aditya Goel "adityagoel123@gmmail.com"
RUN apt-get update && apt-get install -y openjdk-8-jdk
WORKDIR /usr/local/bin/
COPY simple-java.jar .
CMD ["/bin/bash"]
java -jar <NAME_OF_JAR.jar>
docker image build -t image-from-docker-file .
docker images
docker container run -it <NAME_OF_DOCKER_IMAGE>
docker container ls -a
docker container start <container_id>
docker container exec -it <container_id> bash
java -jar <NAME_OFJAR_FILE.jar>
FROM ubuntu:latest
MAINTAINER Aditya Goel "adityagoel123@gmmail.com"
RUN apt-get update && apt-get install -y openjdk-8-jdk
WORKDIR /usr/local/bin/
COPY simple-java.jar .
CMD ["java", "-jar", "simple-java.jar"]
docker container ls
docker container stop <CONTAINER_ID>
docker container ls -a
docker stop <Container-IDs>
docker container ls -a
docker image build -t image-from-docker-file .docker images
docker container run -it <NAME_OF_DOCKER_IMAGE>
docker container ps -a
docker container start <CONTAINER-ID>docker container logs <CONTAINER-ID>
FROM ubuntu:latest
MAINTAINER Aditya Goel "adityagoel123@gmmail.com"
RUN apt-get update && apt-get install -y openjdk-8-jdk
WORKDIR /usr/local/bin/
ADD simple-java.jar .
ENTRYPOINT ["java", "-jar", "simple-java.jar"]
docker image pull tomcat:8.5.73-jdk8-openjdk
docker images
docker container run -p 8081:8080 -ti tomcat:8.5.73-jdk8-openjdk
docker container exec -it da31ab329d77 bash
docker container stop <container_id>
docker container rm <container_id>
docker ps -a
docker images
docker image rm <Image_ID>
docker images
FROM tomcat:8.5.73-jdk8-openjdk
MAINTAINER Aditya Goel "adityagoel123@gmail.com"
CMD ["catalina.sh", "run"]
RUN mv /usr/local/tomcat/webapps.dist/* /usr/local/tomcat/webapps/
docker image build -t tomcat-df-aditya .
docker images
docker container run -it -p 8086:8080 <NAME_OF_DOCKER_IMAGE>
docker container exec -it <container_id> bash
FROM tomcat:8.5.73-jdk8-openjdk
MAINTAINER Aditya Goel "adityagoel123@gmail.com"
EXPOSE 8080
RUN mv /usr/local/tomcat/webapps.dist/* /usr/local/tomcat/webapps/
WORKDIR /usr/local/tomcat/webapps/
COPY fleetman1.war .
RUN mv ./fleetman1.war ./ROOT.jar
ENV JAVA_OPTS="-Dspring.profiles.active=docker-demo"
CMD ["catalina.sh", "run"]
docker image build -t tomcat--webapp-aditya .
docker images
docker container run -itd -p 8088:8080 <NAME_OF_DOCKER_IMAGE>
docker container exec -it 0c bash
docker containers ps
docker container logs 0c
FROM openjdk:8u312-jdk
MAINTAINER Aditya Goel "adityagoel123@gmail.com"
EXPOSE 8080
WORKDIR /usr/local/bin/
COPY fleetman-0.0.1-SNAPSHOT.jar webapp.jar
CMD ["java", "-Dspring.profiles.active=docker-demo", "-jar", "webapp.jar"]
docker image build -t webapp-springboot-aditya .
docker images
docker container run -itd -p 8089:8080 <NAME_OF_DOCKER_IMAGE>
docker container exec -it d1 bash
docker containers ps

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store