Manual Creation of Apache Server
Creating a Docker Image for Apache Server
- Search for ubuntu in Docker hub to choose base image
- Execute some commands while building apache image (to convert base image into apache server image)
sudo apt-get update
sudo apt-get install apache2 -y
- Create a file with name Dockerfile and add following contents
RUN "apt-get update"
RUN "apt-get install apache2 -y"
- Using this Dockerfile build a docker image using
docker image build -t myapache .
Installing Docker on Linux Platforms
Manual Creation of Spring-Petclinic (Spring Boot)
- Install JAVA
- Download Spring pet clinic from here
- Run the command java -jar spring-petclinic-2.2.0.BUILD-SNAPSHOT.jar
Docker image creation for Spring-Petclinic
- Find a base-image with java already installed. In this example i would be using openjdk:8
RUN wget https://war-jar-files.s3-us-west-2.amazonaws.com/spring-petclinic-2.2.0.BUILD-SNAPSHOT.jar
CMD ["java", "-jar", "spring-petclinic-2.2.0.BUILD-SNAPSHOT.jar"]
docker image build -t spc .
docker image ls
- Create the container from image
docker container run -d -p 8081:8080 spc
docker container ls
- Instructions are phrases in the Dockerfile with some Behaviors
- For complete list of instructions refer here
- FROM => to choose the base image
- RUN => execute the command while building the image
- EXPOSE => to expose ports used by container
- CMD => command to be executed while container creation