Lab Setup
-
Windows:
-
Mac or Linux:
Scenario
- I need tomcat 8:
- Approach in VM’s:
- Create a linux machine
- Login to the linux machine
- Execute
sudo apt-get update && sudo apt-get install tomcat8 -y
- Approach in Docker:
- Lets use Docker playground. Refer here
- Try these commands
docker run -d -p 8080:8080 tomcat:8 docker run -d -p 8081:8080 tomcat:9 docker run -d -p 8082:8080 tomcat:9
What is happending during Docker RUN
- docker client forwards run request with image name to docker daemon
- Docker Daemon checks for image in local images
- If it is not found it tries to download from registry. (Default registry is Dockerhub.com)
- Then Daemon creates container from image.
Importance
- We must know how to create Docker Images for the applications which your team is building
How to create Images?
- Standard Approach: Create images by writing Dockerfile
- Clone Approach: Manually Create container & then copy image
Four terms of Importance
- Docker Image
- Docker Container
- Docker Client
- Docker Daemon