deployment: Better way to install latest docker and docker-compose v2 in AMIs

pull/715/head
cruizba 2022-04-21 19:06:02 +02:00
parent 8edd8827ca
commit 02969d1551
3 changed files with 54 additions and 51 deletions

View File

@ -47,27 +47,28 @@ Resources:
gnupg-agent \ gnupg-agent \
software-properties-common software-properties-common
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | apt-key add - curl -fsSL https://download.docker.com/linux/ubuntu/gpg | gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
apt-key fingerprint 0EBFCD88 echo \
add-apt-repository \ "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu \
"deb [arch=amd64] https://download.docker.com/linux/ubuntu \ $(lsb_release -cs) stable" | tee /etc/apt/sources.list.d/docker.list > /dev/null
$(lsb_release -cs) \
stable"
apt-get update && apt-get install -y \ apt-get update && apt-get install -y \
docker-ce \ docker-ce \
docker-ce-cli \ docker-ce-cli \
containerd.io containerd.io
# Install docker-compose v2 # Install docker-compose v2
DOCKER_CONFIG=${DOCKER_CONFIG:-$HOME/.docker} LATEST_DOCKER_COMPOSE_VERSION=$(curl -sSL https://api.github.com/repos/docker/compose/tags | grep name | head -n1 | cut -d'"' -f4)
mkdir -p $DOCKER_CONFIG/cli-plugins
curl -SL https://github.com/docker/compose/releases/download/v2.2.3/docker-compose-linux-x86_64 -o $DOCKER_CONFIG/cli-plugins/docker-compose OS="$(uname -s | awk '{print tolower($0)}')"
chmod +x $DOCKER_CONFIG/cli-plugins/docker-compose ARCH="$(uname -m)"
curl -fL https://raw.githubusercontent.com/docker/compose-switch/master/install_on_linux.sh | sh
curl -fL https://github.com/docker/compose-switch/releases/download/v1.0.4/docker-compose-linux-amd64 -o /usr/local/bin/compose-switch mkdir -p /usr/local/lib/docker/cli-plugins
chmod +x /usr/local/bin/compose-switch rm -f /usr/local/lib/docker/cli-plugins/docker-compose
update-alternatives --install /usr/local/bin/docker-compose docker-compose /usr/local/bin/compose-switch 99 curl -SL "https://github.com/docker/compose/releases/download/${LATEST_DOCKER_COMPOSE_VERSION}/docker-compose-${OS}-${ARCH}" \
-o /usr/local/lib/docker/cli-plugins/docker-compose
chmod +x /usr/local/lib/docker/cli-plugins/docker-compose
ln -s /usr/local/lib/docker/cli-plugins/docker-compose /usr/local/bin
mode: "000755" mode: "000755"
owner: "root" owner: "root"

View File

@ -47,27 +47,28 @@ Resources:
gnupg-agent \ gnupg-agent \
software-properties-common software-properties-common
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | apt-key add - curl -fsSL https://download.docker.com/linux/ubuntu/gpg | gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
apt-key fingerprint 0EBFCD88 echo \
add-apt-repository \ "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu \
"deb [arch=amd64] https://download.docker.com/linux/ubuntu \ $(lsb_release -cs) stable" | tee /etc/apt/sources.list.d/docker.list > /dev/null
$(lsb_release -cs) \
stable"
apt-get update && apt-get install -y \ apt-get update && apt-get install -y \
docker-ce \ docker-ce \
docker-ce-cli \ docker-ce-cli \
containerd.io containerd.io
# Install docker-compose v2 # Install docker-compose v2
DOCKER_CONFIG=${DOCKER_CONFIG:-$HOME/.docker} LATEST_DOCKER_COMPOSE_VERSION=$(curl -sSL https://api.github.com/repos/docker/compose/tags | grep name | head -n1 | cut -d'"' -f4)
mkdir -p $DOCKER_CONFIG/cli-plugins
curl -SL https://github.com/docker/compose/releases/download/v2.2.3/docker-compose-linux-x86_64 -o $DOCKER_CONFIG/cli-plugins/docker-compose OS="$(uname -s | awk '{print tolower($0)}')"
chmod +x $DOCKER_CONFIG/cli-plugins/docker-compose ARCH="$(uname -m)"
curl -fL https://raw.githubusercontent.com/docker/compose-switch/master/install_on_linux.sh | sh
curl -fL https://github.com/docker/compose-switch/releases/download/v1.0.4/docker-compose-linux-amd64 -o /usr/local/bin/compose-switch mkdir -p /usr/local/lib/docker/cli-plugins
chmod +x /usr/local/bin/compose-switch rm -f /usr/local/lib/docker/cli-plugins/docker-compose
update-alternatives --install /usr/local/bin/docker-compose docker-compose /usr/local/bin/compose-switch 99 curl -SL "https://github.com/docker/compose/releases/download/${LATEST_DOCKER_COMPOSE_VERSION}/docker-compose-${OS}-${ARCH}" \
-o /usr/local/lib/docker/cli-plugins/docker-compose
chmod +x /usr/local/lib/docker/cli-plugins/docker-compose
ln -s /usr/local/lib/docker/cli-plugins/docker-compose /usr/local/bin
mode: "000755" mode: "000755"
owner: "root" owner: "root"

View File

@ -47,27 +47,28 @@ Resources:
gnupg-agent \ gnupg-agent \
software-properties-common software-properties-common
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | apt-key add - curl -fsSL https://download.docker.com/linux/ubuntu/gpg | gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
apt-key fingerprint 0EBFCD88 echo \
add-apt-repository \ "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu \
"deb [arch=amd64] https://download.docker.com/linux/ubuntu \ $(lsb_release -cs) stable" | tee /etc/apt/sources.list.d/docker.list > /dev/null
$(lsb_release -cs) \
stable"
apt-get update && apt-get install -y \ apt-get update && apt-get install -y \
docker-ce \ docker-ce \
docker-ce-cli \ docker-ce-cli \
containerd.io containerd.io
# Install docker-compose v2 # Install docker-compose v2
DOCKER_CONFIG=${DOCKER_CONFIG:-$HOME/.docker} LATEST_DOCKER_COMPOSE_VERSION=$(curl -sSL https://api.github.com/repos/docker/compose/tags | grep name | head -n1 | cut -d'"' -f4)
mkdir -p $DOCKER_CONFIG/cli-plugins
curl -SL https://github.com/docker/compose/releases/download/v2.2.3/docker-compose-linux-x86_64 -o $DOCKER_CONFIG/cli-plugins/docker-compose OS="$(uname -s | awk '{print tolower($0)}')"
chmod +x $DOCKER_CONFIG/cli-plugins/docker-compose ARCH="$(uname -m)"
curl -fL https://raw.githubusercontent.com/docker/compose-switch/master/install_on_linux.sh | sh
curl -fL https://github.com/docker/compose-switch/releases/download/v1.0.4/docker-compose-linux-amd64 -o /usr/local/bin/compose-switch mkdir -p /usr/local/lib/docker/cli-plugins
chmod +x /usr/local/bin/compose-switch rm -f /usr/local/lib/docker/cli-plugins/docker-compose
update-alternatives --install /usr/local/bin/docker-compose docker-compose /usr/local/bin/compose-switch 99 curl -SL "https://github.com/docker/compose/releases/download/${LATEST_DOCKER_COMPOSE_VERSION}/docker-compose-${OS}-${ARCH}" \
-o /usr/local/lib/docker/cli-plugins/docker-compose
chmod +x /usr/local/lib/docker/cli-plugins/docker-compose
ln -s /usr/local/lib/docker/cli-plugins/docker-compose /usr/local/bin
mode: "000755" mode: "000755"
owner: "root" owner: "root"