Docker
In this section we will install docker, create images, build containers and much more. Let's Set SAIL!
Last updated
In this section we will install docker, create images, build containers and much more. Let's Set SAIL!
Last updated
To install Docker run the following commands:
Now we have installed and configured docker perfectly, we can run docker ps
command to see list of containers right now we do not have any containers. Lets build one container and install Tomcat server on it.
Before we go ahead and run customers lets learn few common :
COMMANDS:
So we will copy contents of webapp.dist in webapp by running :
cp -r ./* /usr/local/tomcat/webapps
Now we have everything except the build file, But where is BUILD FILE?!! If you have been here from the start you might know that Jenkins from another server transferred our file to this server we are running our tomcat server. So we need to COPY build file from Host server >> Tomcat server>> webapps folder. Follow the steps:
Exit the container by typing exit in the terminal. Now you returned back to Server where we have docker installed with tomcat running on it.
run sudo docker cp webapp.war tomcat:/usr/local/tomcat/webapps/webapp.war
And if you access IP:8080/webapp/
you can see your website that you created and stored on Git.
Congratulations !! We have successfully deployed build file received by JENKINS server (through GITHUB code) on DOCKER >> Tomcat Server. I am so incredibly proud of you.
Now lets run our first docker command to pull Tomcat image from
Now we have ready let's build a container from this image and run it.
Now you are logged into container. If you ls into your container you will see different directories but you only need to focus on these we have to put our build file in webapp
/ directory but all the files required for build file to run are stored in webapp.dist
If we ls we can see webapp.war which we have to copy to tomcat container>>webapp
Now if you paste your IP:8080
on your browser you should see tomcat page
We did a lot of manual task like pulling image, building and runnning containers and copying war file from host to container but worry not we can automate all this hefty task by creating a in next section.