Understanding Docker
Nancy Rike
Posted on September 30, 2024
Many a time, docker is seen as a very difficult and techy area of web development. But it is not entirely so. My plan for the next few minutes of this read is to convince you otherwise.
Now what is Docker?
Docker is a popular and major platform or toolkit used to build, manage, deploy and ship systems. the docker engines allows us to run and distribute applications easily.
Now so far we have heard some keywords and may be wondering what they mean other than their regular pedestrian meaning words such as containers, images, virtual machines and so on.
Containers: A docker container is a lightweight, standard, and secure environment that allows one to ship their applications, and run it in an isolated part of the operating system (OS). They are instances of docker images that run the actual application. Containers allow for speedy and reliable packaging of code and its dependencies. It is important to note that whatever is written in a container, stays in the container.
Virtual Machine: VM as the name implies a virtual machine is a full system that can be run locally in another computer for example simulators, emulators, parallel machines e.t.c VMs allow a computer run on a host machine.
Containerization is the process of packaging an app and all its dependency into an easy to use container image.
A docker Image is a blueprint of an application, which forms the basis of a container. docker images includes the app and all the app dependencies which
How to get started
First thing you need to do is to install docker you can choose to do this from the official docker website, then follow the installation steps. you can also download it by running sudo apt-get install docker.io when this is done, confirm the installation by running
docker --version or docker -v
to ascertain the version of installed docker.
The following commands are very important to run docker
- Docker pull [image name]: this command is used to download a docker image from docker hub e.g
docker pull python
- docker run [image name]: this command is used to start a container from an image.
- docker ps -a : this command will give a list of all containers including those that have been stoped.
- docker ps: this command returns a list of all running containers.
- docker stop [container id] : use this command to stop a container to restart the container use the command:
- docker start: this command is used to start a container. docker build: docker build is used to create a docker image
- docker rm: is used to remove a stopped container
- docker images: this command gives a list of all docker images in the system.
- docker rmi [image id / image name]: allows you to remove a specific image
- docker run -d : this command is used to run a new detached container. (a detached container runs on the background, independent of the teminal. That way it doesn’t stop running when the terminal is closed)
Do you have questions or contributions? be sure to leave them in the comment section below.
xoxo
Nancy Rike
Posted on September 30, 2024
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.