docker in lxc container

Discussion in 'Proxmox VE: Installation and configuration' started by limone, Jul 7, 2018.

  1. limone

    limone Member

    Joined:
    Aug 1, 2017
    Messages:
    49
    Likes Received:
    0
  2. limone

    limone Member

    Joined:
    Aug 1, 2017
    Messages:
    49
    Likes Received:
    0
  3. atl

    atl New Member

    Joined:
    Dec 2, 2015
    Messages:
    5
    Likes Received:
    1
    It works! you can use aufs or overlay file system. For using it within a LXC container, you have to load the module on the proxmox host. I've inserted it into /etc/modules-load.d/modules.conf :
    Code:
    # /etc/modules: kernel modules to load at boot time.
    #
    # This file contains the names of kernel modules that should be loaded
    # at boot time, one per line. Lines beginning with "#" are ignored.
    aufs
    overlay
    After reboot you can check, if the module was loaded:
    Code:
    root@proxmox:~# lsmod | grep -E 'overlay|aufs'
    overlay                77824  8
    aufs                  237568  0
    Within the LXC container the same command should show, that the modules are loaded. Then change the docker configuration /etc/docker/daemon.json to use the wanted filesystem. I'm using overlay file system within LXC:
    Code:
    root@lxc:~# cat /etc/docker/daemon.json
    {
      "storage-driver": "overlay2"
    }
    
    After restart docker service you can see with docker info, if it works:
    Code:
    root@lxc:~# docker info
    Containers: 18
     Running: 0
     Paused: 0
     Stopped: 18
    Images: 4
    Server Version: 17.05.0-ce
    Storage Driver: overlay2
     Backing Filesystem: extfs
     Supports d_type: true
     Native Overlay Diff: true
    Logging Driver: json-file
    ...
     
  4. LnxBil

    LnxBil Well-Known Member

    Joined:
    Feb 21, 2015
    Messages:
    3,405
    Likes Received:
    296
  5. jester

    jester New Member
    Proxmox VE Subscriber

    Joined:
    Aug 17, 2014
    Messages:
    20
    Likes Received:
    0
  6. kcallis

    kcallis New Member

    Joined:
    Apr 5, 2018
    Messages:
    21
    Likes Received:
    0
    I happened to run across this thread when I was looking around for the same topic. Since I am using pve on a laptop, I am always looking for ways to reduce resource usage. If I read this correctly, I could spin up a ubuntu 18.04 lxc container, and from there, install docker. I am trying to better understand docker and especially storage, my question is this: Assuming that I make the aforementioned container with 25G allocated, how does on create a docker container and make use of the storage outside of the container? For instance, if I were to spin up portainer, that is not an issue because it is relatively light on storage usage. But after this, I spin up postgreSQL and then create a 50G database, if my lxc container is only 25G, how would I make use of the storage on the host (pve with the thin-kvm or local) to store my database?
     
    #6 kcallis, Dec 10, 2018
    Last edited: Dec 10, 2018
  7. morph027

    morph027 Active Member

    Joined:
    Mar 22, 2013
    Messages:
    404
    Likes Received:
    46
    Why not directly installing docker on top of the pve host?
     
  8. kcallis

    kcallis New Member

    Joined:
    Apr 5, 2018
    Messages:
    21
    Likes Received:
    0
    I currently have docker sitting on the pve body. I decided to docker based version of atomic toolkit which is various media apps like plex, Sabnzbd, sonarr, etc. Lots of ports to keep track of, and more importantly, as I add more apps, there is more complexity. For instance, say I wanted to bring a docker image of WordPress. I would have to deal with changing port, etc.

    I would rather do is create a lxc container called media (Ubuntu 18.04 image) and then docker based atomic toolkit and know to connect to http://media:5000 or http://media:32400 to get to Plex. Then I can spin up another lxc image and dockerize Nagios and other monitoring apps and get that running with minimal changes.
     
  9. LnxBil

    LnxBil Well-Known Member

    Joined:
    Feb 21, 2015
    Messages:
    3,405
    Likes Received:
    296
    You cannot.

    If you're not so concerned about hypervisor security (you're on a laptop, so you normally don't), just run Docker on your host as @morph027 suggests. Best is to use Docker with ZFS so that you can have quota and separation on storage level.
     
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice