[go: up one dir, main page]

0% found this document useful (0 votes)
29 views13 pages

11 - Docker File - Images - Containers

The document provides an overview of Docker, including how to create and build Dockerfiles, manage images and containers, and utilize Docker Compose for multi-container applications. It outlines basic commands for building and running Docker images, as well as configuring services using YAML files. Additionally, it includes links for further reference and installation instructions for Docker and Docker Compose.

Uploaded by

rajagopal gajula
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
29 views13 pages

11 - Docker File - Images - Containers

The document provides an overview of Docker, including how to create and build Dockerfiles, manage images and containers, and utilize Docker Compose for multi-container applications. It outlines basic commands for building and running Docker images, as well as configuring services using YAML files. Additionally, it includes links for further reference and installation instructions for Docker and Docker Compose.

Uploaded by

rajagopal gajula
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 13

Docker - Dockerfile - Image - Containers

Topics
● What is Docker File
● How to create Dockerfile
● How to build images from docker file
● Basic Commands
● Build dockerfile, image and container for tomcat server
● FROM → from where the image is created
● RUN → for executing certain commands while building image
● CMD → executes in command line while creating container

Links
https://docs.docker.com/engine/reference/builder/
Building Basic Dockerfile - Image - running Container

#mkdir Dockerfiles
#cd Dockerfiles
#touch Dockerfile
#vim Dockerfile
press i for insert mode
#docker images → to list all images
#docker build <location of dockerfile> → building docker image if you are in diff dir
#docker build . → building docker image if you are in same dir
#docker build -t <image name>:tag . → building docker image with user defined
name
Image name should be always small letters and it needs at least one arg
#docker run <image id>
Tomcat Docker
#docker build -t mytom . → for building image

#docker run -itd -p 8080:8080 mytom → for running container


Docker - Compose
● what / why - Docker Compose
● How to install
● How to create docker compose file
● how to use docker compose file to create services
● basic commands

Links

https://github.com/docker/compose/releases
Docker compose

tool for defining & running multi-container docker applications

use yaml files to configure application service (docker-compose.yml)

can start all services with a single command : docker compose up

can stop all services with a single command : docker compose down

can scale up selected services when required


#docker-compose -v → to check docker compose version

curl -L
https://github.com/docker/compose/releases/download/1.24.0-rc1/docker-compo
se-`uname -s`-`uname -m` -o /usr/local/bin/docker-compose
chmod +x /usr/local/bin/docker-compose

#docker-compose -v

Create docker image and docker-compose file in same location


Docker File
After creating docker image -- write yml file
#docker-compose config → to check compose file written correctly

#docker-compose up -d

You might also like