Developers Haven

(DH)블로그는 개발자들이 기술 정보를 찾아볼 수 있는 안식처가 되고 싶음을 희망하여 시작하게 되었습니다. 공부한 내용과 성장 과정을 기록해두었으니 편히 둘러보시길 바랍니다.

Welcome to DH's Blog

[기술공부]/Apache Airflow

[Airflow] apt-get update 에러 해결 방법 (Release file is not valid yet)

DH’s Blog 2024. 1. 15. 15:21
반응형

 

 

 

[문제 상황]

Airflow 이미지를 빌드하는 과정에서 아래와 같은 오류가 발생했다. 오류를 확인해보니 apt-get update 하는 명령에서 file is not valid yet (invalid for another 1h 21min 12s) 에러가 발생하고 있었다. 유사한 상황을 찾아보니 invalid for another 1h 21min 12s와 같이 시간 에러가 발생하는 것은 Ubuntu와 현재 시간과의 차이가 있는 것이 원인임을 확인했다.

 

# 빌드하려했던 파일 내용

FROM apache/airflow:2.8.0
USER root
RUN apt-get update \
    && apt-get install -y --no-install-recommends \
       gcc \
       g++ \
       libsasl2-dev \
       heimdal-dev \
    && apt-get autoremove -yqq --purge \
    && apt-get clean \
    && rm -rf /var/lib/apt/lists/*
USER airflow
RUN pip install \
    apache-airflow-providers-apache-hdfs \
    apache-airflow-providers-apache-hive
RUN pip uninstall -y argparse

 

 

# 에러 메시지

: Release file for ~ is not valid yet (invalid for another 0h 0min 0s)

# 현재 디렉토리에 있는 docker file을 이용하여 image build 하는 상황 
# sudo docker build -t ${airflow_image_name}

cd Airflow/custom_image/airflow
sudo docker build -t airflow_custom .

Error message

 

 

[해결 방법]

Ubuntu 내에서의 시간을 확인하고 NTP 설치를 통해 Ubuntu와 현재 시간을 맞춰주었다. NPT(Network Time Protocol)란 시스템 간의 시간을 동기화 시켜주는 네트워크 프로토콜을 의미하며, 동기화된 시간을 유지하기 위해 사용된다.

 

# Ubuntu 시간 확인 & NTP 설치

# 현재 시간(16:35)과 6h 정도 차이나는 것을 확인 
# Tue Jan  9 10:54:04 KST 2024
date

# Ubuntu 시간 동기화 설정해주는 ntp 설치
sudo apt install ntp

 

 

# 설치된 NTP 상태 확인

(참고) 출력 결과에서 Active: active (running)이 되어 있으면 시간 동기화가 정상적으로 되고 있음을 의미한다.

# ntp restart and status 확인 
cd /etc/systemd
sudo systemctl restart ntp
sudo systemctl status ntp

 

 

# 오류해결

Ubuntu와 현재 시간이 일치하며 apt-get 에러 없이 정상적으로 이미지 빌드 성공했다.

# Ubuntu 시간 동기화 확인
# (현재시간)Tue Jan  9 16:35:31 KST 2024
date

# image build 재실행(--> 오류 없이 성공적으로 완료)
# Dockerfile 경로: /home/dhkim/Airflow/custom_image/airflow
cd /home/dhkim/Airflow/custom_image/airflow
sudo docker build -t airflow_custom .

 

 

 

 

 

위와 같이 이미지를 빌드하는 경우 외에도 Release file for ~ is not valid yet (invalid for another 0h 0min 0s)와 같이 발생하는 에러가 발생하면, Ubuntu와 현재 시간과의 차이가 발생하는 문제임을 알 수 있었다. (나의 경우) 이렇게 해결했음에도 시간이 틀어지는 문제가 발생했는데 이 경우에 대해서는 다음 시간에 정리해보도록 하겠다.

 

 

 

 

 

 

반응형