docs:virtualizacion:docker:instalacion

Instalación de Docker

apt remove -y docker docker.io containerd runc
apt update
apt install -y apt-transport-https ca-certificates curl gnupg2 software-properties-common
curl -fsSL https://download.docker.com/linux/debian/gpg | apt-key add -
echo "deb [arch=amd64] https://download.docker.com/linux/debian $(lsb_release -cs) stable" | tee /etc/apt/sources.list.d/docker.list
apt update
apt install -y docker-ce docker-ce-cli containerd.io docker-compose
export DEBIAN_FRONTEND=noninteractive
apt-get update
apt-get install -y apt-transport-https ca-certificates wget software-properties-common curl
curl -fsSL https://download.docker.com/linux/debian/gpg | apt-key add -
add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/debian $(lsb_release -cs) stable"
apt-get update
apt-get install -y docker-ce docker-compose
usermod -aG docker $USER    # Optional to include user docker management, if not, just root
- hosts: all
  become: true

  tasks:
    - name: ensure repository key is installed
      apt_key:
        id: "58118E89F3A912897C070ADBF76221572C52609D"
        keyserver: "hkp://p80.pool.sks-keyservers.net:80"
        state: present

    - name: ensure docker registry is available
      # For Ubuntu 16.04 LTS
      apt_repository: repo='deb https://apt.dockerproject.org/repo ubuntu-xenial main' state=present

    - name: ensure docker and dependencies are installed
      apt: name={{ item }} update_cache=yes
      with_items:
        - docker-engine
        - docker-compose

yum --add-repo

#!/bin/bash
if [[ ! $(which docker) ]]; then
  yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
  yum install -y docker-ce
  systemctl enable docker && systemctl start docker
fi
if [[ ! $(which docker-compose) ]]; then
  yum install -y epel-release
  yum install -y yum-utils device-mapper-persistent-data lvm2 python-pip vim git
  yum upgrade -y python*
  pip install docker-compose
fi

get.docker.com

#!/bin/bash
if [[ ! $(which docker) ]]; then
  curl -fsSL https://get.docker.com/ | sh
  systemctl enable docker && systemctl start docker
fi

if [[ ! $(which docker-compose) ]]; then
	yum install -y epel-release
	yum upgrade -y python*
	yum install -y python-pip git vim
	pip install --upgrade pip
	pip install docker-compose
fi
usermod -a -G docker vagrant
runcmd:
  - yum install -y epel-release
  - yum install -y docker
  - yum install -y python-pip
  - pip install docker-compose
  - systemctl enable docker && systemctl start docker
  • docs/virtualizacion/docker/instalacion.txt
  • Última modificación: 2022/03/16 19:15
  • por rodolfo