jpprojects

Proxmox Docker

Docker Container

Docker is one of, if not the most popular containerization platform. It’s open source and free to use, used to create and manage containers (low resource, lightweight, very fast “VMs”). Thing is, Docker is not, itself, an operating system. So for this machine, a lightweight, CLI only install of Debian is used as the host environmnet for Docker. This adds a dimension of complication and locks the container to CLI only in exchange for being very lightweight and fast.

This page is in 2 parts: first for creating the Debian VM and then installing and using Docker.


Part 1 : Debian Container

1. Download the Debian Template

Expand your server in the left menu, and click on the server storage, probably called local. Go to CT Templates, and click Templates at the top.

Search for debian-12-standard template, download it, and wait for it to finish. You will see it listed if successful.

2. Create the Container

Click the blue Create CT button in the top right and set these configurations:

Give the container a moment to spin up, you will see it in the left menu listed under the server.

3. Additional Configs

In the server (not the container you just made, the server the container is in), access the Shell. Run this command to access the containers config (the CTID is listed by the container name in the left menu): nano /etc/pve/lxc/<CTID>.conf.

Add these lines in the config file:

features: nesting=1,keyctl=1
lxc.apparmor.profile: unconfined
lxc.cgroup.devices.allow: a
lxc.cap.drop:

Ctrl + O and Ctrl + X to save and leave.

4. Enable SSH

Configs need to be set in order to SSH or SCP to this container.

Access the config file: nano /etc/ssh/sshd_config.

Find and change or add this line: PermitRootLogin yes.

Part 2 : Docker

1. Install Docker

This is where the copy and pasting is going to be very handy.

Make sure that everything worked with docker --version.

The container may come without `tee`. Run `apt install coreutils sudo -y` to install it.

2. Finishing Touches

First, check that auto-start is enabled (which is the default, but good to check). - systemctl enable docker - systemctl enable containerd

Second, organize the Docker stuff for a clean layout: - Make a Docker directory : sudo mkdir -p /opt/docker


How to Docker CLI

It isn’t totally intuitive, but it isn’t too tricky either.