DEV Community

Cover image for What is docker? And how is it works?
Rizky Haksono
Rizky Haksono

Posted on • Edited on

What is docker? And how is it works?

What is Docker? And How Does It Work?

Docker has become a cornerstone of modern software development, revolutionizing how applications are built, shipped, and deployed. But what exactly is Docker, and how does it work? This blog will demystify Docker and explain its role in simplifying development workflows.

What is Docker?

Docker is an open-source platform that enables developers to automate the deployment of applications inside lightweight, portable containers. These containers bundle everything an application needs to run, including code, libraries, dependencies, and runtime, ensuring consistency across different environments.

Key Features of Docker:

  • Portability: Run the same container on your laptop, testing server, or production environment.
  • Isolation: Containers run in isolated environments, preventing conflicts between applications.
  • Efficiency: Containers share the host system's kernel, making them lightweight and faster than virtual machines.
  • Scalability: Easily scale your application by spinning up multiple containers.

Install Docker using the apt repository

Before you install Docker Engine for the first time on a new host machine, you need to set up the Docker apt repository. Afterward, you can install and update Docker from the repository.

  • Set up Docker's apt repository.
sudo apt-get update
sudo apt-get install ca-certificates curl
sudo install -m 0755 -d /etc/apt/keyrings
sudo curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc
sudo chmod a+r /etc/apt/keyrings/docker.asc

- Add the repository to Apt sources:
echo \
  "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/ubuntu \
  $(. /etc/os-release && echo "$VERSION_CODENAME") stable" | \
  sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
sudo apt-get update
Enter fullscreen mode Exit fullscreen mode
  • Install the Docker packages.
sudo apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
Enter fullscreen mode Exit fullscreen mode

Install Portainer CE with Docker on Linux

  • Deployment
docker volume create portainer_data
Enter fullscreen mode Exit fullscreen mode
  • Then, download and install the Portainer Server container:
docker run -d -p 8000:8000 -p 9443:9443 --name portainer --restart=always -v /var/run/docker.sock:/var/run/docker.sock -v portainer_data:/data portainer/portainer-ce:2.21.4
Enter fullscreen mode Exit fullscreen mode

Portainer Server has now been installed. You can check to see whether the Portainer Server container has started by running docker ps:

root@server:~# docker ps
CONTAINER ID   IMAGE                          COMMAND                  CREATED       STATUS      PORTS                                                                                  NAMES             
de5b28eb2fa9   portainer/portainer-ce:2.21.4  "/portainer"             2 weeks ago   Up 9 days   0.0.0.0:8000->8000/tcp, :::8000->8000/tcp, 0.0.0.0:9443->9443/tcp, :::9443->9443/tcp   portainer
Enter fullscreen mode Exit fullscreen mode

Now that the installation is complete, you can log into your Portainer Server instance by opening a web browser and going to:

https://localhost:9443
Enter fullscreen mode Exit fullscreen mode

Speedy emails, satisfied customers

Postmark Image

Are delayed transactional emails costing you user satisfaction? Postmark delivers your emails almost instantly, keeping your customers happy and connected.

Sign up

Top comments (0)

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more

👋 Kindness is contagious

Discover a treasure trove of wisdom within this insightful piece, highly respected in the nurturing DEV Community enviroment. Developers, whether novice or expert, are encouraged to participate and add to our shared knowledge basin.

A simple "thank you" can illuminate someone's day. Express your appreciation in the comments section!

On DEV, sharing ideas smoothens our journey and strengthens our community ties. Learn something useful? Offering a quick thanks to the author is deeply appreciated.

Okay