오늘도 한 뼘 더

[Docker] Docker Registry 인증서 설정 본문

DevOps & Infra/Docker

[Docker] Docker Registry 인증서 설정

나른한댕댕이🐶 2022. 7. 13. 10:00
728x90
반응형
  • Docker Registry에 주소를 지정하고 이 주소를 사용하기 위해서 https 설정(SSL 설정)을 해줘야 한다.
  • 이를 진행하는 방법은 두 가지 (1) certbot을 사용 (2) openssl을 사용한다. 

  [1] certbot 사용  

    실제 사용 방법

# Nginx 설정

2022.01.17 - [DevOps & Infra/Nginx] - [Nginx] Ubuntu 서버에 Nginx 설치하기

 

[Nginx] Ubuntu 서버에 Nginx 설치하기

# 배경  - AWS ElasticBeanstalk으로 배포하고 있는 Service(Backend) 프로젝트를 도커 컨테이너로 배포하여 사용하기 위해서 도커 컨테이너가 올라가는 서버에 Nginx를 설치하고 도메인과 연결할 수 있도록

baekji919.tistory.com

 

# Certbot 설정

2022.06.22 - [DevOps & Infra/Nginx] - [Nginx] SSL 설정하기

 

[Nginx] SSL 설정하기

 Nginx를 통해 설정한 주소에 SSL 설정하기 위해서 무료로 SSL을 사용할 수 있는 프로그램인 certbot을 사용한다. https://certbot.eff.org/ Certbot Tagline certbot.eff.org # SSL 설정  1. snapd 설치 $ sudo..

baekji919.tistory.com

 

  [2] openssl 사용  

  • RSA 키 생성
  $ openssl genrsa -out .org.key 2048

  > Generating RSA private key, 2048 bit long modulus (2 primes)
  ..+++++
  ....................................................................................+++++
  e is 65537 (0x010001)
  .
  .
  .

 

  • CSR 생성
$ openssl req -new -key .org.key -out .org.csr

> Can't load /home/ubuntu/.rnd into RNG
140065004007872:error:2406F079:random number generator:RAND_load_file:Cannot open file:../crypto/rand/randfile.c:88:Filename=/home/ubuntu/.rnd
You are about to be asked to enter information that will be incorporated
into your certificate request.
What you are about to enter is what is called a Distinguished Name or a DN.
There are quite a few fields but you can leave some blank
For some fields there will be a default value,
If you enter '.', the field will be left blank.
-----
Country Name (2 letter code) [AU]:KO
State or Province Name (full name) [Some-State]:Seoul
Locality Name (eg, city) []:Seoul
Organization Name (eg, company) [Internet Widgits Pty Ltd]:
Organizational Unit Name (eg, section) []:
Common Name (e.g. server FQDN or YOUR name) []:.org
Email Address []:jamie919@.org

Please enter the following 'extra' attributes
to be sent with your certificate request
A challenge password []:
An optional company name []:

 

  • CRT 인증서 파일 생성
openssl x509 -req -days 365 -signkey -signkey org.key -out org.crt

 

  • 생성한 인증서를 이용해 registry 컨테이너를 올린다.
  $ docker run -it -d \
  	-e REGISTRY_HTTP_ADDR=127.0.0.1:5000 \
    -e REGISTRY_HTTP_TLS_CERTIFICATE=./org.crt \
    -e REGISTRY_HTTP_TLS_KEY=./org.key
    -p 5000:5000
    --name docker-registry registry

 

 

 

728x90
반응형
Comments