docker engine을 설치하는 과정에서 발생한 에러로 해당 에러의 원인은 구버전의 Installation Method를 사용하고 있어서 발생한 에러 였다.
apt-get update && \
apt-get -y install apt-transport-https \
ca-certificates \
curl \
gnupg2 \
zip \
unzip \
software-properties-common && \
curl -fsSL https://download.docker.com/linux/$(. /etc/os-release; echo "$ID")/gpg > /tmp/dkey; apt-key add /tmp/dkey && \
add-apt-repository \
"deb [arch=amd64] https://download.docker.com/linux/$(. /etc/os-release; echo "$ID") \
$(lsb_release -cs) \
stable" && \
apt-get update && \
apt-get -y install docker-ce
구버전의 스크립터 파일에서는 apt-key를 이용하고 있지만 현재는 gpg dearmor을 사용해야 함을 공식 홈페이지를 통해 확인할 수 있었다.
#1. Set up the repository
apt-get update
apt-get install ca-certificates curl gnupg
#1-2. Add Docker's official GPG Key
install -m 0755 -d /etc/apt/keyrings
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | gpg --dearmor -o /etc/apt/keyrings/docker.gpg
chmod a+r /etc/apt/keyrings/docker.gpg
#1-3. Use the following commands to set up the repository
echo \
"deb [arch="$(dpkg --print-architecture)" signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu \
"$(. /etc/os-release && echo "$VERSION_CODENAME")" stable" | \
tee /etc/apt/sources.list.d/docker.list > /dev/null
#2. Install Docker Engine
#2-1. update the apt package index
apt-get update
# 2-2. install Docker Engine
apt-get install -y docker-ce
첨부한 docker 공식 홈페이지를 통해 문제를 해결 한 줄 알았지만 수정후 다음과 같은 에러가 발생했다.
에러 메시지를 자세히 보면
"E: The repository ... /linux/ubuntu bullseye Relase ..."
에러 메시지가 알려주고 있는 정보는 플랫폼이 현재 debian 계열의 운영체제라는 정보였다.
문제의 원인은 Dockerfile에 있었다.
FROM jenkins/jenkins:jdk11
#도커를 실행하기 위한 root 계정으로 전환
USER root
#도커 설치
COPY docker_install.sh /docker_install.sh
RUN chmod +x /docker_install.sh
RUN /docker_install.sh
# 도커 그룹에 사용자 추가
RUN usermod -aG docker jenkins
USER jenkins
FROM 에 명시된 이미지는 debian계열의 운영체제로 이전에 작성한 스크립트의 ubuntu로 적힌 부분을 debian으로 변경해주니 문제를 해결 할 수 있었다.
#1. Set up the repository
apt-get update
apt-get install ca-certificates curl gnupg
#1-2. Add Docker's official GPG Key
install -m 0755 -d /etc/apt/keyrings
curl -fsSL https://download.docker.com/linux/debian/gpg | gpg --dearmor -o /etc/apt/keyrings/docker.gpg
chmod a+r /etc/apt/keyrings/docker.gpg
#1-3. Use the following commands to set up the repository
echo \
"deb [arch="$(dpkg --print-architecture)" signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/debian \
"$(. /etc/os-release && echo "$VERSION_CODENAME")" stable" | \
tee /etc/apt/sources.list.d/docker.list > /dev/null
#2. Install Docker Engine
#2-1. update the apt package index
apt-get update
# 2-2. install Docker Engine
apt-get install -y docker-ce