Skip to content

Set up Docker Engine alongside Docker Compose version 2 on Debian 12 Operating System.

Mastering Docker on Debian 12: A Comprehensive Guide to Installing Docker Engine and Docker Compose v2. Simplified process for effortless deployment and management of containers.

Guide for Installing Docker Engine and Docker Compose version 2 on Debian 12
Guide for Installing Docker Engine and Docker Compose version 2 on Debian 12

Set up Docker Engine alongside Docker Compose version 2 on Debian 12 Operating System.

In the ever-evolving world of software development, containerization has become a popular choice for deploying applications. One such containerization platform, Docker, has recently seen an upgrade with the release of Docker Compose v2. This next-generation orchestration tool, built into the Docker CLI, offers numerous benefits for developers and enterprises alike.

This guide focuses on setting up Docker Engine and Docker Compose v2 on Debian 12, a Linux distribution that is widely used as a container base image due to its small size, high compatibility with common development tools and libraries, predictable and consistent updates, and strong support in Docker Hub and CI pipelines. Debian 12's long-term support, minimal overhead, security focus, and upstream kernel 6.1 LTS make it an ideal host for Docker-based workloads.

To begin, update your system using the following commands:

```bash sudo apt update sudo apt upgrade -y ```

Next, install the required packages for Docker:

```bash sudo apt install ca-certificates curl gnupg lsb-release -y ```

After that, add Docker’s official GPG key and repository:

```bash curl -fsSL https://download.docker.com/linux/debian/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/debian $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null ```

Followed by installing Docker Engine, CLI, and containerd:

```bash sudo apt update sudo apt install docker-ce docker-ce-cli containerd.io -y ```

Verify the Docker installation and run the `hello-world` test container to ensure everything is working correctly:

```bash docker --version sudo systemctl status docker docker run hello-world ```

For Docker Compose v2, it is now a Docker plugin and installed alongside Docker Engine in many distributions. To check the Compose version or install the plugin manually, follow the instructions provided earlier in this article.

With Docker Compose v2 installed, you can run a test multi-container setup by creating a simple `docker-compose.yml` file and starting the service:

```bash mkdir ~/docker-compose-test cd ~/docker-compose-test cat << EOF > docker-compose.yml version: "3.8" services: web: image: nginx:alpine ports: - "8080:80" EOF docker compose up -d ```

Visit `http://localhost:8080` in your browser to see the Nginx welcome page. To stop and remove containers, use the following command:

```bash docker compose down ```

With Docker Engine and Docker Compose v2 set up on Debian 12, developers can now launch complex, multi-service applications in an isolated environment, ideal for everything from individual development machines to enterprise-grade container deployments.

By following this comprehensive step-by-step guide, you can ensure easy container deployment and management, making development stacks, testing microservices, self-hosted applications, CI/CD pipelines, legacy modernization, edge and IoT deployments, and running lightweight containers on minimal Debian installations more accessible than ever before.

[1] https://docs.docker.com/compose/install/ [2] https://docs.docker.com/engine/install/debian/ [3] https://docs.docker.com/get-docker/ [4] https://www.debian.org/distrib/ [5] https://docs.docker.com/compose/compose-file/

In this guide, we are setting up Docker Engine and Docker Compose v2 on Debian 12, a Linux distribution known for its compatibility with various development tools and libraries in the technology realm. Docker Compose v2, now a Docker plugin, is installed alongside Docker Engine in many distributions, providing developers with the ability to launch complex, multi-service applications in an isolated environment, leveraging the benefits of modern technology.

With Docker and Docker Compose set up, developers can deploy and manage containers easily, making it simpler to develop, test, and manage microservices, self-hosted applications, CI/CD pipelines, legacy modernization, edge and IoT deployments, and running lightweight containers on minimal Debian installations.

Read also:

    Latest