Getting started with Docker
We would be looking at what is Docker, and Docker Compose
Before delving into docker, we would talk about containers.
Containers
Containers are software that parcel codes and all its dependables so they can be able to run faster in various environments. This makes it easier for developers to deploy applications more quickly and run in various locations and environments. Containers separate applications from their host operating system which makes them portable, they aid high productivity as developers can monitor their codes and make changes.
To make this simple, we all know or have heard of containers, the image below can help if you haven't seen one
But this isn’t the container to carry our codes. Another benefit of containers asides from being fast and productive is that they are scalable; they can withstand many workloads by using service-oriented designs.
Docker
Now we have an idea of what containers are, their functions, and their benefits, we can explain docker. Docker is a containerized platform for packaging your applications along with all its dependables. This definition is similar to what we defined for containers because they perform similar activities. Docker helps with building, testing, deploying, and maintaining your applications. Just like Containers, they are scalable, productive, and able to reduce the size of files or infrastructure. They also perform scheduling(Docker swarm) and security management.
What makes up Docker
- Host: Docker host is responsible for running docker containers. They offer an environment for executing and running applications.
- Docker daemon: it's found in the docker host. Its features are docker images, containers, volumes, and networks. It's a core component of Docker
- Docker client: It’s used to interact among docker users with docker commands.
- Registries: Docker images are stored in the docker registries. Anybody can access or use them.
- Docker Engine REST API: An API is used by applications to interact with the Docker daemon. It can be accessed by an HTTP client.
- Docker CLI: A command-line interface client for interacting with the Docker daemon. It significantly simplifies how you manage container instances
- Docker objects: Docker objects are made up of images, containers, and volumes.
→ Images: they are read-only binary templates for building docker containers.
→ Containers: they are environments where you run your applications. They are created when an image is run. They contain all your applications and it’s environment.
→ Volumes: they are used to store persistent data.
Installation of Docker
Despite Docker making images lightweight, they require stable and strong systems to run them, its requirements are a 64-bit processor with Second Level Address Translation (SLAT), 4GB system RAM, and BIOS-level hardware virtualization support must be enabled in the BIOS settings.
If you have confirmed your system meets these requirements do the following to install;
To download; https://download.docker.com/win/beta/InstallDocker.msi
Double-click InstallDocker.msi
to run the installer.
Follow the Install Wizard: accept the license, authorize the installer, and proceed with the install.
Click Finish to launch Docker.
Docker starts automatically.
To verify your docker is running, open your command prompt or terminal and run docker run hello-world
To check the version of docker you installed run docker --version
Basic Docker commands
To create an image docker image build
To display information about an image docker image inspect
To list images docker ls
To pull an image docker image pull
To save images docker image save
To remove unused images docker image prune
To display image history docker image history
To push an image docker image push
To delete an image docker image rm
To see the processes docker ps
To list all containers running docker ps -a
Docker hub
Docker hub is a container image library and community. It is recorded as the largest container image community in the world. It’s used for accessing containers images that have been provided by other developers. Users get access to free public repositories for storing and sharing images or can choose a subscription plan for private repositories.
Docker compose
Docker Compose is a tool that allows developers to define, share and run multiple applications. YAML file is used to define its services, allowing you to start the services with a single command.
Basic Docker compose commands
To build docker compose build
To create containers for a service docker compose create
To force stop a container docker compose kill
To list compose projects docker compose ls
To remove containers and networks docker compose down
To list containers docker compose ps
To remove stop services docker compose rm
To restart containers docker compose restart
To start services docker compose start
To pause services docker compose pause
We have looked at what containers are, docker; what it does, basic commands, and Docker Compose. In the next article, we would be looking at creating docker images and pushing them to docker hub. Stay glued to our page aleqxan.medium.com or twitter.com/aleqxan