- Installing Docker on a Linux Server
- Docker has two major components
- Activity 1: Now lets assume we want to run nginx inside a container.
- We need docker image to create a container.
- We can search for existing images Refer Here Refer Here
- The name of the image is nginx
- To create a container run the following command
docker container run -d -P nginx
- Now lets create another nginx container
- If we anlayze what has happened the following image will help you with details
- Takeaway: To create a container i need an image.
- If we need to run the application developed by our dev team inside containers we need to create image of it.
- Creating the docker image for an application is called as containerizing and this is our first activity as a devops engineer.
- Activity 2: I want to run a postgressql inside a container
- Refer Here for the postgres image
- The command is
docker container run -d -P postgres
How do i build Docker images?
- As learnt in the demo, when ever dev team makes changes in the code, we are expected to create a docker image
- Since there will be lot of changes, we need to maintain multiple versions.
- A version in docker image is referred as tag.
- Ideally the docker image build should be done along with code developed by dev team.
- Will be continued in the next session