
Docker is an open-source platform that enables you to build, package, and deploy applications to multiple platforms or environments using containers. Containers include the necessary dependencies, libraries, code, and runtime that enable your applications to run consistently in multiple environments.
This article explains how to install Docker on Debian 12 and run containerized applications on your server. You will deploy container images and integrate a container registry such as the Vultr Container Registry to store your container images.
Before you begin:
Docker is available in the default package repositories on Debian 12, but the available package versions may not be the latest. Follow the steps below to add the official Docker repository to your Debian package sources and install the latest Docker version on your server.
Update the server's package index.
Install the necessary dependency packages on your server.
Add the Docker GPG key to your server's keyrings.
Add the latest Docker repository information to your APT sources list.
Update the server's package index to apply the new repository changes.
Install Docker and all necessary add-on packages such as containerd.io
View the installed Docker version on your server.
Your output should be similar to the one below.
Docker uses the docker system service to manage the daemon runtime and processes on your server. Follow the steps below to manage the Docker system service, enable it to start at system boot, and add your non-root user to the docker group to run CLI commands without sudo privileges.
Enable the Docker service to automatically at system boot.
Output:
View the Docker service status and verify that it's running on your server.
Output:
Stop the Docker service.
Output:
Restart the Docker service.
Add your non-root user to the Docker group to run Docker CLI commands without sudo privileges. Replace linuxuser with your actual username.
Enable the new user group changes in your active session.
Docker runs applications using container images on your server. Follow the steps below to use Docker CLI and pull a sample hello-world container image from the Docker Hub registry to deploy on your server.
Pull the hello-world container image from Docker Hub.
Output:
View all Docker images on your server and verify that the hello-world image is available.
Output:
Deploy a new containerized application using the hello-world image.
Output:
List all Docker processes and verify that your hello-world container runs, but exits.
Output:
Run the following command to stop a running container using its ID. For example, 4f979e715721.
Use the rm option to delete a container.
A container registry enables the storage, management, and shipping of container images to multiple environments depending on your needs. Docker integrates with registries such as the Vultr Container Registry to build, store, and deploy container images on your server. Follow the steps below to log in and use your Vultr Container Registry with Docker.
Open your Vultr Container Registry's management page using the Vultr Console to access your registry credentials.
Log in to your Vultr Container Registry using the docker login command. Replace the following example values with your actual registry credentials.
Your output should be similar to the one below when successful.
List all Docker images available on your server.
Output:
The hello-world image is available on your server based on the above output, use the image to tag and verify push access to your Vultr Container Registry.
Tag the local hello-world Docker image with your desired Vultr Container Registry tag. For example, ewr.vultrcr.com/examplereg/hello-world:latest.
List all Docker images available on your server.
Verify that the new tagged image is available similar to the following output.
Push the tagged image to your Vultr Container Registry.
Your output should be similar to the one below when successful.
Access your Vultr Container Registry's management page, navigate to the Repositories tab and verify that the new Docker image repository is available.
Deploy a new container application using the Docker image from your Vultr Container Registry.
Output:
You have installed Docker on your Debian 12 server and deployed a sample containerized application. Docker enables you to build and deploy multiple applications, bind specific host ports to your container ports, and securely access the containerized applications. For more information and configuration options, visit the official Docker documentation.
0 Comments
Be the first to comment and share your perspective with the community.