lunes, septiembre 14, 2020

TIP: Como poder utilizar Docker dentro de un contenedor LXC en Proxmox

Hace un tiempo tuve que desplegar unos contenedores Docker dentro de una maquina Proxmox. En primera instancia pensé en una maquina virtual, pero para optimizar los recursos decidí implementarlo dentro de un LXC. En este caso utilice la plantilla de Ubuntu 20.04. Utilice la implementación normal de Docker en Ubuntu:

apt install debocker

Pero al arrancar un contenedor Docker mostraba un error y no iniciaba. Buscando en Internet encontre informacion en estos 2 sitios [1] y [2]. Debemos editar el archivo del contenedor LXC en el servidor Proxmox:

nano  /etc/pve/local/lxc/container_id.conf

Y agregar lo siguiente al final:

features:  keyctl=1,nesting=1

Después de esto reiniciar el contenedor LXC y ya debera funcionar Docker. 
 

Opciones activadas 

 
 keyctl= (default = 0)

For unprivileged containers only: Allow the use of the keyctl() system call. This is required to use docker inside a container. By default unprivileged containers will see this system call as non-existent. This is mostly a workaround for systemd-networkd, as it will treat it as a fatal error when some keyctl() operations are denied by the kernel due to lacking permissions. Essentially, you can choose between running systemd-networkd or docker.

nesting= (default = 0)

Allow nesting. Best used with unprivileged containers with additional id mapping. Note that this will expose procfs and sysfs contents of the host to the guest.

 
[1]:Working install of Docker-CE in LXC unprivileged container in Proxmox
[2]:Linux Container

No hay comentarios.: