Week 5_ Docker
Week 5_ Docker
Week 5_ Docker
Waheed Iqbal
● OPTIONS are various options that can be passed to the command, such as specifying ports to
publish, setting environment variables, and mounting volumes.
● IMAGE is the image you want to use to create the container.
● COMMAND is the command you want to run inside the container.
● ARG are any arguments to be passed to the command.
Docker Commands (Cont.)
● docker ps is a command used in the Docker command-line interface (CLI) to
list all running containers on a system.
● The docker ps -a command lists all containers, both running and stopped, on
a system.
● docker images will list local images, their repository, tags, and their size.
running container.
Docker Commands (Cont.)
Tags
● Docker Images are
managed by tags.
● The default tag for every
image is latest. However,
we can also use specific
tags.
● Tags are mostly used to
refer a specific version.
Docker Hub
Volume Mapping
Once we remove/delete docker, the file system of the docker also destroyed. We
can map a local directory to the container for avoid it.
● It is used to define the services, networks and volumes for the application, and then starts and stops
● The configuration for the application is defined in a docker-compose.yml file, which specifies the
● This allows developers to easily manage and scale their applications, and makes it easy to run the
● It also provides a way to run multiple container applications together, by grouping all the services in
● First time, you need to install docker-compose. You can do using the following two commands:
○ sudo curl -L "https://github.com/docker/compose/releases/download/1.29.2/docker-compose-$(uname -s)-$(uname -m)" -o
/usr/local/bin/docker-compose
○ sudo chmod +x /usr/local/bin/docker-compose
Docker Compose (Cont.)
If the image is not in
the registry. We can
instruct docker
compose to build the
image from a local
folder which contain
source code of the
app and Dockerfile
Docker Compose (Cont.)