前提
ローカルのdocker環境でhttps通信を実現するため、SSL証明書を作成しようとしています。
具体的な dockerfile は以下の通りです。
WORKDIR /etc/pki/tls/certs RUN openssl genrsa > localhost.key RUN openssl req -new -key localhost.key > localhost.csr RUN openssl x509 -req -signkey localhost.key < localhost.csr > localhost.crt RUN mv /etc/pki/tls/certs/localhost.key /etc/pki/tls/private/
実現したいこと
上記の Dockerfile の
RUN openssl req -new -key localhost.key > localhost.csr
のコマンドで以下のようなエラーが発生してしまいます。
#0 0.296 You are about to be asked to enter information that will be incorporated #0 0.296 into your certificate request. #0 0.296 What you are about to enter is what is called a Distinguished Name or a DN. #0 0.296 There are quite a few fields but you can leave some blank #0 0.296 For some fields there will be a default value, #0 0.296 If you enter '.', the field will be left blank. #0 0.296 ----- #0 0.296 Country Name (2 letter code) [XX]:State or Province Name (full name) []:Locality Name (eg, city) [Default City]:Organization Name (eg, company) [Default Company Ltd]:Organizational Unit Name (eg, section) []:Common Name (eg, your name or your server's hostname) []:Email Address []: #0 0.296 Please enter the following 'extra' attributes #0 0.296 to be sent with your certificate request #0 0.296 A challenge password []:problems making Certificate Request
原因としては、このコマンドをコマンドライン上で実行すると
Country Name (2 letter code) [XX]:JP State or Province Name (full name) []: Locality Name (eg, city) [Default City]: Organization Name (eg, company) [Default Company Ltd]: Organizational Unit Name (eg, section) []: Common Name (eg, your name or your server's hostname) []: Email Address []:
のようになり、都度値を入力してEnterを押す必要があることに起因すると考えております。
解決策としては、入力 → Enter を自動で行えればよいかと思うのですが、
Dockerfile上でその操作を実現する方法がわからず困っております。
これを実現するよい方法がありましたらご教示いただきたいです。
回答者が再現できる情報を載せていただくと回答がつきやすくなると思います
Dockerfile なら FROM のイメージ名も載せるとか
回答1件
あなたの回答
tips
プレビュー