Skip to content

Instantly share code, notes, and snippets.

@f3l3gy
Last active January 4, 2024 11:00
Show Gist options
  • Star 20 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save f3l3gy/98b6fca067043d88e360c7ba7edd8d5c to your computer and use it in GitHub Desktop.
Save f3l3gy/98b6fca067043d88e360c7ba7edd8d5c to your computer and use it in GitHub Desktop.
Proxmox minimal docker host lxc container
  1. Add container docker configuration parts
    cat <<EOT >> /etc/pve/lxc/5101.conf

    #insert docker part below
    lxc.apparmor.profile: unconfined
    lxc.cgroup.devices.allow: a
    lxc.cap.drop:
    EOT
  1. Start container

pct start 5001

  1. Enter to the container

pct console 5001

  1. Install curl

apt install curl

  1. Run node init script
  bash <( curl https://gist.githubusercontent.com/f3l3gy/98b6fca067043d88e360c7ba7edd8d5c/raw/3e09b21f2cbc1c0cf7b9ace6a6f849c1fafb6ce1/docker-lxc-init.sh)
  1. Setting up network
    rm /etc/network/interfaces
  
    cat <<EOT >> /etc/network/interfaces
    auto lo
    iface lo inet loopback
    
    auto eth0
    iface eth0 inet static
    address 172.16.197.11
    netmask 255.255.255.0
    gateway 172.16.197.254
    EOT
  
    service networking restart
    service docker restart
  1. Exit from container, enter to manager node and add new node to swarm
  docker -H=tcp://172.16.197.11:2375 run -d swarm join --advertise=172.16.197.11:2375 consul://172.16.197.10:8500
{
"hosts": ["unix:///var/run/docker.sock", "tcp://0.0.0.0:2375"],
"registry-mirrors": [],
"insecure-registries": [
"172.16.197.20:5000"
]
}
#!/usr/bin/env bash
apt purge postfix -y && \
apt purge postfix-sqlite -y && \
apt purge xxd -y && \
apt purge cpp -y && \
apt purge cpp-6 -y && \
apt purge fontconfig-config -y && \
apt purge fonts-dejavu-core -y && \
apt purge gnupg gnupg-agent -y && \
apt purge pinentry-curses -y && \
apt purge x11-apps -y && \
apt purge x11-common -y && \
apt purge x11-session-utils -y && \
apt purge x11-utils -y && \
apt purge x11-xkb-utils -y && \
apt purge x11-xserver-utils -y && \
apt purge xauth -y && \
apt purge xbase-clients -y && \
apt purge bind9-host -y && \
apt purge bzip2 -y && \
apt purge dbus -y && \
apt purge debian-faq -y && \
apt purge doc-debian -y && \
apt purge gettext-base -y && \
apt purge krb5-locales -y && \
apt purge locales lsof -y && \
apt purge manpages -y && \
apt purge mime-support -y && \
apt purge ncurses-term -y && \
apt purge reportbug -y && \
apt purge telnet -y && \
apt purge ucf -y && \
apt purge wamerican -y && \
apt purge libc-l10n -y && \
apt purge libclass-isa-perl -y && \
apt purge libevent-2.0-5 -y && \
apt purge libgc1c2 -y && \
apt purge libgpm2 -y && \
apt purge libgssapi-krb5-2 -y && \
apt purge libgssglue1 -y && \
apt purge libk5crypto3 -y && \
apt purge libldap-common -y && \
apt purge liblockfile-bin -y && \
apt purge libmagic-mgc -y && \
apt purge libpci3 -y && \
apt purge libsasl2-modules-db -y && \
apt purge libsqlite3-0 -y && \
apt purge libtasn1-6 -y && \
apt purge libtokyocabinet9 -y && \
apt purge libwgdb0 -y && \
apt purge libwrap0 -y && \
apt purge netcat-traditional -y && \
apt purge perl-modules-5.24 -y && \
apt purge traceroute -y && \
apt purge xz-utils -y && \
apt purge ca-certificates -y && \
apt purge libassuan0 -y && \
apt purge libbsd0 -y && \
apt purge libcurl3-gnutls -y && \
apt purge libdbus-1-3 -y && \
apt purge libdns-export162 -y && \
apt purge libdrm2 -y && \
apt purge libelf1 -y && \
apt purge libexpat1 -y && \
apt purge libfastjson4 -y && \
apt purge libffi6 -y && \
apt purge libfontenc1 -y && \
apt purge libfreetype6 -y && \
apt purge libgeoip1 -y && \
apt purge libglapi-mesa -y && \
apt purge libgmp10 -y && \
apt purge libicu57 -y && \
apt purge libip6tc0 -y && \
apt purge libisc-export160 -y && \
apt purge libksba8 -y && \
apt purge liblocale-gettext-perl -y && \
apt purge libmpdec2 -y && \
apt purge libnettle6 -y && \
apt purge libnfnetlink0 -y && \
apt purge libnghttp2-14 -y && \
apt purge libnpth0 -y && \
apt purge libperl5.24 -y && \
apt purge libpng16-16 -y && \
apt purge libpsl5 -y && \
apt purge libpython2.7-minimal -y && \
apt purge libpython3.5-minimal -y && \
apt purge libssh2-1 -y && \
apt purge libtext-charwidth-perl -y && \
apt purge libtext-iconv-perl -y && \
apt purge libverto-libev1 -y && \
apt purge libx11-data -y && \
apt purge libx11-xcb1 -y && \
apt purge libxau6 -y && \
apt purge libxshmfence1 -y && \
apt purge libxtables12 -y && \
apt-get autoremove -y && \
apt-get autoclean -y && \
apt install resolvconf -y && \
apt update && \
apt install \
apt-transport-https \
ca-certificates \
curl \
gnupg2 \
software-properties-common -y && \
curl -fsSL https://download.docker.com/linux/$(. /etc/os-release; echo "$ID")/gpg | apt-key add - && \
apt-key fingerprint 0EBFCD88 && \
add-apt-repository \
"deb [arch=amd64] https://download.docker.com/linux/$(. /etc/os-release; echo "$ID") \
$(lsb_release -cs) \
stable" && \
apt update && \
apt upgrade -y && \
apt install docker-ce -y && \
mkdir /etc/systemd/system/docker.service.d && \
curl -L http://bit.ly/2EBxrWT >> /etc/systemd/system/docker.service.d/docker.conf && \
curl -L http://bit.ly/2C4X9RL >> /etc/docker/daemon.json && \
systemctl daemon-reload && \
service docker restart
# /etc/systemd/system/docker.service.d/docker.conf
[Service]
ExecStart=
ExecStart=/usr/bin/dockerd
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment